Skip to content

Instantly share code, notes, and snippets.

@joshcough
Last active August 29, 2015 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshcough/6e2b13a025121811748b to your computer and use it in GitHub Desktop.
Save joshcough/6e2b13a025121811748b to your computer and use it in GitHub Desktop.
import scalaz.stream._
import scalaz.stream.Process._
object WriterProps {
def convert[A](str: Stream[A]): Process0[A] = str match {
case hd #:: tail => emit(hd) ++ convert(tail)
case _ => halt
}
def main (args: Array[String]): Unit = {
convert(Stream(0, 1) map { i =>
if (i % 2 == 0) i else throw new java.lang.Exception("odd:" + i)
})
()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment