Skip to content

Instantly share code, notes, and snippets.

@bukzor
Last active August 17, 2020 05:25
Show Gist options
  • Save bukzor/2ee0ea6d1c454f000f3d01ce19018662 to your computer and use it in GitHub Desktop.
Save bukzor/2ee0ea6d1c454f000f3d01ce19018662 to your computer and use it in GitHub Desktop.
cat.IO.readline<A: Type>(_: A): IO(String)
use line = IO.ask<String>("get_line", "")
IO.end<String>(line)
cat.go<A: Type>(io: IO(A)): IO(Unit)
get bind pure = IO.monad
let io1 = bind<,>(io, cat.IO.readline<>)
let io2 = bind<,>(io1, IO.print)
cat.go<>(io2)
cat: IO(Unit)
get bind pure = IO.monad
let io0 = pure<>(Unit.new)
cat.go<>(io0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment