Scalaz iteratees: “Lifting” `EnumeratorT` to match `IterateeT` for a “bigger” monad

If I have an EnumeratorT and a corresponding IterateeT I can run them together:

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:

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?

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.

1 Answer
1

Leave a Comment