Last active
August 29, 2015 14:25
-
-
Save joshcough/6e2b13a025121811748b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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