diff options
| author | Akshay Nair <phenax5@gmail.com> | 2023-01-06 20:07:28 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2023-01-06 20:07:28 +0530 |
| commit | a56f093bf08780ab7ed7ef196f031c193a522922 (patch) | |
| tree | f7328d5c154cd7d4521b3bc9575cf89fe6671d5e /src/index.ts | |
| parent | d0baefe81d90d44f61322716e20850a7f6f5eaa5 (diff) | |
| download | ts-types-lang-a56f093bf08780ab7ed7ef196f031c193a522922.tar.gz ts-types-lang-a56f093bf08780ab7ed7ef196f031c193a522922.zip | |
feat: we got custom effects baebeeyyy
Diffstat (limited to 'src/index.ts')
| -rw-r--r-- | src/index.ts | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/index.ts b/src/index.ts index df2643a..e764623 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,4 +1,4 @@ -import { Program, Print, PutString, Bind, Debug, Kind1, GetEnv, JsExpr, ReadFile, GetArgs, ReadLine, Seq } from './stdlib' +import { Print, PutString, Bind, Debug, Kind1, GetEnv, JsExpr, ReadFile, GetArgs, ReadLine, Seq, Effect, DefineEffect } from './stdlib' interface PrintK<Label extends string = ""> extends Kind1<unknown> { return: Debug<Label, this['input']> @@ -12,7 +12,14 @@ interface StartGuessing extends Kind1<number> { return: Bind<Seq<[PutString<"Your guess? ">, ReadLine]>, AskForGuess<this['input']>> } -export type main = Program<[ +interface Wow<_A, _B> extends Effect { } + +export type main = [ + DefineEffect<"Wow", `(a, b) => { + console.log(typeToString(a), '-->', typeToString(b)) + }`>, + Wow<"a", 69>, + Bind<GetArgs, PrintK>, PutString<"1,2,3? ">, [1, 2, 3] extends infer Res ? Print<Res> : never, @@ -34,5 +41,5 @@ export type main = Program<[ Print<"Wow">, Bind<JsExpr<"200 * 2">, PrintK<"200 * 2 =">>, ]>, -]> +] |
