aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-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>,
+]
+