Translation of a stream's effect type is currently supported via Stream#translate and Stream#translateInterruptible. Translation is eagerly applied. Due to some forthcoming changes to cats.effect.Resource (https://github.com/typelevel/cats-effect/issues/1255) as well as the desire to support interruptible resource acquisition (#2077), we may need to move translation to be a constructor in the stream algebra.
Some discussion: https://gitter.im/typelevel/cats-effect-dev?at=5f830fe3a1c81d0a7ed68025
@diesalbla Any interest in working on this one? You know the internals as well as anyone, especially the translation stuff.
@mpilquist I will take a look later today.
Adding here for context some of the discussions:
So, [the current implementation] applies eagerly to the algebra. TBH, I think the only hope here is to try to get the evaluation of translate pushed into the actual compilation loop, which means giving it a first class case in the algebra.
I would try to do that independent of poll like, if that's doable, then poll should have a solution there (that should also eliminate the need for translateInterruptible btw). But… if that's not doable then we have a bit of a problem. By Daniel Spjiewak
Easy enough to add a
Translatecase, but i have no idea how to implement thecase t: Translate[…]handler in Pull.compile.go, which needs to callview.next(..)withdef next(r: Result[X]): Pull[F, O, R]. By @mpilquist
Given that we can have many translations of streams nested with other stream translations, we would have to attach a FunctionK[F, G] to the compile loop, as a new parameter. S