Created
May 6, 2019 17:19
-
-
Save kevinmeredith/241173ffdbedf8509942b971516e17dd 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 $ivy.`org.typelevel::cats-effect:0.10.1` | |
import $ivy.$ | |
@ import cats.effect.IO, cats.implicits._ | |
import cats.effect.IO, cats.implicits._ | |
@ val foo: IO[Either[String, Int]] = IO(throw new RuntimeException("!")) | |
foo: IO[Either[String, Int]] = Delay(ammonite.$sess.cmd2$$$Lambda$2001/359985955@1bbfd42f) | |
@ foo.attempt | |
res3: IO[Either[Throwable, Either[String, Int]]] = Bind(Delay(ammonite.$sess.cmd2$$$Lambda$2001/359985955@1bbfd42f), <function1>) | |
@ foo.attempt.unsafeRunSync match { | |
case Left( rte : RuntimeException ) => true | |
case _ => false | |
} | |
res4: Boolean = true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment