aboutsummaryrefslogtreecommitdiff
path: root/examples/greeting.ts
blob: 72edde26be6b76d5b40b8c57f004d1185eeb40b7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import { Bind, Kind1 } from '../stdlib/effect'
import { PutString, ReadLine, PutStringLn } from '../stdlib/stdio'

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, <name extends string>() => PutStringLn<`Hello, ${name}`>>,

  PutStringLn<'----------------'>,
  PutString<'Your purpose in life? '>,
  Bind<ReadLine, ResponseK>,

  PutStringLn<'----------------'>
]