0
在scala7.0.6:下列程序工作:進口scalaz.syntax.traverse._不起作用
import scalaz._, Scalaz._
object Playground extends App {
val smallNumbers = List(1,2,3,4,5)
val doubleSmall: Int => Option[Int] = x => if (x < 30) Some(x * 2) else None
import scalaz.syntax.traverse._
println(smallNumbers.traverse(doubleSmall))
}
但是,如果我移動import scalaz.syntax.traverse._
對象Playground
外,在頂部文件,然後我得到:
Error: value traverse is not a member of List[Int]
這是爲什麼?