aboutsummaryrefslogtreecommitdiff
path: root/examples/hello-world.ts
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2023-01-12 18:41:49 +0530
committerAkshay Nair <phenax5@gmail.com>2023-01-12 18:41:49 +0530
commita107048f87828b87b3bd55db1b6217710c40ee84 (patch)
tree2aa04a13f0d2987cc3eb7efe979d77834e2b57ce /examples/hello-world.ts
parent3020be98876613b19dcc79f6cc8cade12460ba48 (diff)
downloadts-types-lang-a107048f87828b87b3bd55db1b6217710c40ee84.tar.gz
ts-types-lang-a107048f87828b87b3bd55db1b6217710c40ee84.zip
feat: adds mutable reference effects
Diffstat (limited to 'examples/hello-world.ts')
-rw-r--r--examples/hello-world.ts20
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>,
+]
+