diff options
| author | Akshay Nair <phenax5@gmail.com> | 2023-01-12 18:41:49 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2023-01-12 18:41:49 +0530 |
| commit | a107048f87828b87b3bd55db1b6217710c40ee84 (patch) | |
| tree | 2aa04a13f0d2987cc3eb7efe979d77834e2b57ce /examples | |
| parent | 3020be98876613b19dcc79f6cc8cade12460ba48 (diff) | |
| download | ts-types-lang-a107048f87828b87b3bd55db1b6217710c40ee84.tar.gz ts-types-lang-a107048f87828b87b3bd55db1b6217710c40ee84.zip | |
feat: adds mutable reference effects
Diffstat (limited to '')
| -rw-r--r-- | examples/hello-world.ts | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/examples/hello-world.ts b/examples/hello-world.ts new file mode 100644 index 0000000..fcdb8e9 --- /dev/null +++ b/examples/hello-world.ts @@ -0,0 +1,20 @@ +import { Bind, Do, Kind1 } from "../stdlib/effect"; +import { CreateRef, GetRef, Ref, SetRef } from "../stdlib/ref"; +import { Print } from "../stdlib/stdio"; + +interface PrintK extends Kind1 { + return: Print<this['input']> +} + +interface Func extends Kind1<Ref> { + return: Do<[ + SetRef<this['input'], 69>, + Bind<GetRef<this['input']>, PrintK>, + ]> +} + +export type main = [ + Bind<CreateRef<200>, Func>, + Print<1>, +] + |
