aboutsummaryrefslogtreecommitdiff
path: root/examples/greeting.ts
blob: 8ed21818afbf3c0e22ecd2d6718fabc108bbbffa (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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<'----------------'>,
]