aboutsummaryrefslogtreecommitdiff
path: root/examples/custom-effect.ts
blob: 5fbffede12618423fa5a7611b2a4a9cc8803d581 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import { Bind, DefineEffect, Effect, Kind1, Print } from '../stdlib'

interface Mathemagic<_A, _B> extends Effect { }

interface PrintK extends Kind1 {
  return: Print<this['input']>
}

export type main = [
  DefineEffect<"Mathemagic", `(a, b) => {
    console.log(typeToString(a))
    return { result: 5 * b.getLiteralValue() }
  }`>,
  Bind<Mathemagic<"a", 69>, PrintK>,
]