Last active
August 29, 2015 14:01
-
-
Save jrudolph/e1f62f5517a839c7bb81 to your computer and use it in GitHub Desktop.
for / yield desugaring
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
> scala -Xprint:parser | |
scala> trait A { def getB: Int } | |
scala> def getA(): A = null | |
scala> def x = for { a <- Option(getA()); b <- Option(a.getB) } yield b | |
[[syntax trees at end of parser]] // <console> | |
[... snip ...] | |
def x = Option(getA()).flatMap(((a) => Option(a.getB).map(((b) => b)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment