Skip to content

Instantly share code, notes, and snippets.

Last active Aug 29, 2015
What would you like to do?
Typelevel Scala has an option to make for-comprehensions easier to reason about
erik@vx-2 ~/w/tlc (2.11.x) ⛭ ./build/quick/bin/scala -Zirrefutable-generator-patterns
Welcome to Scala version 2.11.3-20141005-222847-d37174644b (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_04).
Type in expressions to have them evaluated.
Type :help for more information.
scala> val list: List[Any] = List((1,2), (3,4), 1, (4,5))
list: List[Any] = List((1,2), (3,4), 1, (4,5))
scala> for { (a, b) <- list } yield a
scala.MatchError: 1 (of class java.lang.Integer)
at $anonfun$1.apply(<console>:9)
... 33 elided
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment