aboutsummaryrefslogtreecommitdiff
path: root/examples/custom-effect.ts
blob: 6a4b8b023b2ae24c065afb2524b890ea77bd5aa2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import { Bind, DefineEffect, Effect, Kind1, Print } from '../src/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>,
]