From d5d685253568f8c6855dd873ac3623e0af642d54 Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Fri, 6 Jan 2023 23:33:00 +0530 Subject: feat: adds output for custom effects + adds custom effect example for ffi --- examples/custom-effect.ts | 15 ++++++++++----- examples/ffi.ts | 9 ++++++++- examples/guess-number.ts | 6 +++--- 3 files changed, 21 insertions(+), 9 deletions(-) (limited to 'examples') diff --git a/examples/custom-effect.ts b/examples/custom-effect.ts index 948caf4..6a4b8b0 100644 --- a/examples/custom-effect.ts +++ b/examples/custom-effect.ts @@ -1,10 +1,15 @@ -import { DefineEffect, Effect } from '../src/stdlib' +import { Bind, DefineEffect, Effect, Kind1, Print } from '../src/stdlib' -interface Wow<_A, _B> extends Effect { } +interface Mathemagic<_A, _B> extends Effect { } + +interface PrintK extends Kind1 { + return: Print +} export type main = [ - DefineEffect<"Wow", `(a, b) => { - console.log(typeToString(a), '-->', typeToString(b)) + DefineEffect<"Mathemagic", `(a, b) => { + console.log(typeToString(a)) + return { result: 5 * b.getLiteralValue() } }`>, - Wow<"a", 69>, + Bind, PrintK>, ] 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