Created
July 26, 2015 22:05
-
-
Save joshcough/cfce120c60057a203275 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
def convert[A](str: => Stream[A]): Process[Task, Throwable \/ A] = | |
Process.eval((Task delay str map { | |
case hd #:: tail => emit(hd.right) ++ convert(tail) | |
case Stream.Empty => halt | |
}).attempt) flatMap { | |
case lf@ -\/(_) => emit(lf) | |
case \/-(p) => p | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment