本文共 1036 字,大约阅读时间需要 3 分钟。
本文翻译自:
If I have an EnumeratorT
and a corresponding IterateeT
I can run them together: 如果我有一个EnumeratorT
和一个相应的IterateeT
我可以一起运行它们:
val en: EnumeratorT[String, Task] = EnumeratorT.enumList(List("a", "b", "c"))val it: IterateeT[String, Task, Int] = IterateeT.length(it &= en).run : Task[Int]
If the enumerator monad is "bigger" than the iteratee monad, I can use up
or, more generally, Hoist
to "lift" the iteratee to match: 如果枚举器monad比iteratee monad“更大”,我可以用up
或者更常见的是,使用Hoist
“提升”iteratee以匹配:
val en: EnumeratorT[String, Task] = ...val it: IterateeT[String, Id, Int] = ...val liftedIt = IterateeT.IterateeTMonadTrans[String].hoist( implicitly[Task |>=| Id]).apply(it)(liftedIt &= en).run: Task[Int]
But what do I do when the iteratee monad is "bigger" than the enumerator monad? 但是当iteratee monad比枚举器monad“更大”时,我该怎么办?
val en: EnumeratorT[String, Id] = ...val it: IterateeT[String, Task, Int] = ...it &= ???
There doesn't seem to be a Hoist
instance for EnumeratorT
, nor any obvious "lift" method. 似乎没有EnumeratorT
的Hoist
实例,也没有任何明显的“提升”方法。
转载地址:http://pfexb.baihongyu.com/