【发布时间】:2011-11-30 01:05:50
【问题描述】:
我在 2.9.1 和 2.10 nightly 中得到不同的行为 - 发生了什么变化?
Welcome to Scala version 2.9.1.final (OpenJDK Client VM, Java 1.6.0_22).
Type in expressions to have them evaluated.
Type :help for more information.
scala> Some(3) map (x => List(x, -x)) flatten
res0: List[Int] = List(3, -3)
对比:
Welcome to Scala version 2.10.0.r26084-b20111129020255 (OpenJDK Client VM, Java 1.6.0_22).
Type in expressions to have them evaluated.
Type :help for more information.
scala> Some(3) map (x => List(x, -x)) flatten
<console>:8: error: Cannot prove that List[Int] <:< Option[B].
Some(3) map (x => List(x, -x)) flatten
【问题讨论】:
标签: scala