3
如何爲BufferedReader創建枚舉器?Scalaz迭代器,爲BufferedReader創建枚舉器
我發現相當老的文章:http://apocalisp.wordpress.com/2010/10/17/scalaz-tutorial-enumeration-based-io-with-iteratees/,它看起來像它不與Scalaz 6.0.4工作
我嘗試基於例如從這裏創建枚舉:Idiomatic construction to check whether a collection is ordered
implicit val ListEnumerator = new Enumerator[List] {
def apply[E, A](e: List[E], i: IterV[E, A]): IterV[E, A] = e match {
case List() => i
case x :: xs => i.fold(done = (_, _) => i,
cont = k => apply(xs, k(El(x))))
}
}
但我無法理解如何將IO monad與枚舉器相結合
謝謝,它的工作!但據我所知,scalaz的演變,從6版本更方便的方式是提供枚舉器 – 2012-02-22 15:31:24