aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2023-01-14 10:24:18 +0530
committerAkshay Nair <phenax5@gmail.com>2023-01-14 10:24:18 +0530
commit2979eda13e25725683aa10292b31f22793c4e0c0 (patch)
tree7ec461ec25e06719f6f3344152b9344bfee1f97b /examples
parent518a6a9ee31f0b03f08cb77bc613b4d708bb640b (diff)
downloadts-types-lang-2979eda13e25725683aa10292b31f22793c4e0c0.tar.gz
ts-types-lang-2979eda13e25725683aa10292b31f22793c4e0c0.zip
chore: adds fancy syntax for bind functions
Diffstat (limited to 'examples')
-rw-r--r--examples/greeting.ts15
1 files changed, 12 insertions, 3 deletions
diff --git a/examples/greeting.ts b/examples/greeting.ts
index d3d755f..8ed2181 100644
--- a/examples/greeting.ts
+++ b/examples/greeting.ts
@@ -1,12 +1,21 @@
import { Bind, Kind1 } from '../stdlib/effect'
import { PutString, ReadLine, PutStringLn } from '../stdlib/stdio'
-interface GreetK extends Kind1<string> {
- return: PutStringLn<`Hello, ${this['input']}`>
+interface ResponseK extends Kind1<string> {
+ return: PutStringLn<`Interesting that you believe "${this['input']}" is your purpose. Hmmmm...`>
}
export type main = [
PutStringLn<'Greetotron 6000 initializing...'>,
+
+ PutStringLn<'----------------'>,
PutString<'Your name? '>,
- Bind<ReadLine, GreetK>
+ Bind<ReadLine, <name extends string>() =>
+ PutStringLn<`Hello, ${name}`>>,
+
+ PutStringLn<'----------------'>,
+ PutString<'Your purpose in life? '>,
+ Bind<ReadLine, ResponseK>,
+
+ PutStringLn<'----------------'>,
]