src/stop.bend
bolt@1.27.0.0 · 26 lines · 3 definitions
1
2
3
4import Base
5import bolt@1.27.0.0/src/args.bend as Args
6
7
8def say(to: Args.Stream, text: String) -> IO(Unit):
9 match to:
10 case Args.Line{}:
11 IO.print(text)
12 case Args.Page{}:
13 IO.write(text)
14 case Args.Err{}:
15 IO.print_err(text)
16
17def leave.at(zero: Bool, code: U32) -> IO(Unit):
18 match zero:
19 case True{}:
20 IO.pure(Unit, Unit{})
21 case False{}:
22 IO.die(Unit, code, "")
23
24
25def leave(+code: U32) -> IO(Unit):
26 leave.at(U32.is_eq(code, 0), code)