如何为 BufferedReader 创建 Enumerator?
我发现了相当老的文章:http : //apocalisp.wordpress.com/2010/10/17/scalaz-tutorial-enumeration-based-io-with-iteratees/ 看起来它不适用于Scalaz 6.0.4
我尝试根据此处的示例创建 Enumerator:Idiomatic construction to check if 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 与 Enumerator 结合起来