Last active
August 29, 2015 14:07
-
-
Save non/f262a7df9521b8db77d8 to your computer and use it in GitHub Desktop.
Typelevel Scala has an option to make for-comprehensions easier to reason about
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
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) | |
at scala.collection.immutable.List.map(List.scala:276) | |
... 33 elided |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment