Created
April 11, 2020 08:33
-
-
Save polyglotpiglet/d721698f1d742e77159d31adf6651956 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
object Main extends App { | |
import cats._ | |
import cats.implicits._ | |
val ans: Eval[Int] = for { | |
a <- Eval.now { println("a"); 40 } | |
b <- Eval.always { println( "b" ); 2 } | |
c <- Eval.later { println( "c" ); 2 } | |
} yield { | |
println("Adding!") | |
a + b + c | |
} | |
println("---") | |
ans.value // ignored | |
ans.value // ignored | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment