aboutsummaryrefslogtreecommitdiff
path: root/examples/custom-effect.ts
blob: 3dbe3958bfa105b0b7331b9ac01213f8f0bf723b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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>
]