此代码使用"com.jsuereth" %% "scala-arm" % "2.0"
:
import resource._
val lineLengths = for {
source <- managed(scala.io.Source.fromFile("file.txt"))
line <- source.getLines()
} yield line.length
编译失败并显示错误:
Expression of type Iterator[Int] doesn't conform to expected type ManagedResource[B_]
有什么主意吗?