Skip to content

Instantly share code, notes, and snippets.

@halcat0x15a
Created October 4, 2011 09:19
Show Gist options
  • Save halcat0x15a/1261217 to your computer and use it in GitHub Desktop.
Save halcat0x15a/1261217 to your computer and use it in GitHub Desktop.
output all element
def putStrLn[E: Show]: IterV[E, IO[Unit]] = {
def step(i: IO[Unit])(input: Input[E]): IterV[E, IO[Unit]] =
input(el = e => Cont(step(i >|> effects.putStrLn(e.shows))),
empty = Cont(step(i)),
eof = Done(i, EOF[E]))
Cont(step(mzero[IO[Unit]]))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment