aboutsummaryrefslogtreecommitdiff
path: root/examples/file.ts
blob: 5af04da7fd9dd1c6adfb37d5b82d5cff4bc7860b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import { Bind, Kind1 } from '../stdlib/effect'
import { PutStringLn } from '../stdlib/stdio'
import { ReadFile } from '../stdlib/fs'
import { Try } from '../stdlib/exception'

interface PrintK extends Kind1<string> {
  return: PutStringLn<this['input']>
}

export type main = [
  Bind<ReadFile<'./default.nix'>, <contents extends string>() =>
    PutStringLn<contents>>,

  Try<
    Bind<ReadFile<'./unicorn'>, PrintK>,
    <M extends string>() => PutStringLn<`ERROR: ${M}`>
  >
]