aboutsummaryrefslogtreecommitdiff
path: root/examples/ffi.ts
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--examples/ffi.ts9
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 ='>>,
]