Created
February 2, 2014 05:26
-
-
Save PipelineBaron/8763471 to your computer and use it in GitHub Desktop.
Y U NO TRAMPOLINE
This file contains hidden or 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._ | |
| import scalaz.concurrent._ | |
| import Future._ | |
| object Main { | |
| def lamePrint(s: String): Future[Unit] = async { next => | |
| println(s) | |
| next() | |
| } | |
| def loop(s: String): Future[Unit] = for ( | |
| sync <- lamePrint(s); | |
| _ <- loop(s) | |
| ) yield () | |
| final def main(args: Array[String]) { | |
| loop("boom").run | |
| } | |
| } |
This file contains hidden or 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._ | |
| import effect._ | |
| import IO._ | |
| object Main { | |
| def loop(s: String): IO[Unit] = for( | |
| _ <- putStrLn(s); | |
| _ <- loop(s) | |
| ) yield () | |
| final def main(args: Array[String]) { | |
| loop("boom").unsafePerformIO() | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment