diff options
| author | Akshay Nair <phenax5@gmail.com> | 2023-01-06 23:33:00 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2023-01-06 23:35:33 +0530 |
| commit | d5d685253568f8c6855dd873ac3623e0af642d54 (patch) | |
| tree | 3274f8eb52e64e60ab86080f20a55339f4ca5e35 /examples/ffi.ts | |
| parent | 4d82623f191042c362ddd2ad5e8ded99d5854169 (diff) | |
| download | ts-types-lang-d5d685253568f8c6855dd873ac3623e0af642d54.tar.gz ts-types-lang-d5d685253568f8c6855dd873ac3623e0af642d54.zip | |
feat: adds output for custom effects + adds custom effect example for ffi
Diffstat (limited to 'examples/ffi.ts')
| -rw-r--r-- | examples/ffi.ts | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/examples/ffi.ts b/examples/ffi.ts index 7a73a0a..3310712 100644 --- a/examples/ffi.ts +++ b/examples/ffi.ts @@ -1,4 +1,4 @@ -import { Bind, Debug, JsExpr, Kind1 } from "../src/stdlib" +import { Bind, Debug, DefineEffect, Effect, JsExpr, Kind1 } from "../src/stdlib" interface PrintK<Label extends string = ""> extends Kind1 { return: Debug<Label, this['input']> @@ -6,7 +6,14 @@ interface PrintK<Label extends string = ""> extends Kind1 { type Square<N extends number> = JsExpr<`${N} ** 2`> +interface Mathemagic<_A, _B extends number> extends Effect { } + export type main = [ Bind<JsExpr<"{ boobaa: [5 * 3, 5 * 2] }">, PrintK<'|'>>, Bind<Square<69>, PrintK<"69^2 =">>, + DefineEffect<"Mathemagic", `(a, b) => { + console.log(typeToString(a)) + return { result: 5 * b.getLiteralValue() } + }`>, + Bind<Mathemagic<"a", 69>, PrintK<'69 * 5 ='>>, ] |
