[Haskell-cafe] conduit: Finalize field in PipeM

Paolo Capriotti p.capriotti at gmail.com
Fri May 4 18:51:11 CEST 2012

On Fri, May 4, 2012 at 9:40 AM, Michael Snoyman <michael at snoyman.com> wrote:
> I think the underlying point of distinction between conduit and
> pipes-core here is that, is conduit, a Pipe of type `Pipe i o m r` is
> *required* to provide an `r` value ultimately. If I understand
> correctly, this is not the case in pipes-core. I believe this also
> explains your question about the `MonadTrans` instance: `Finalize` is
> not simply "clean up resources," it's "clean up resources __and__
> return the required `r` value." That's why we duplicate the base monad
> action: it's the only way to get a value of type `r` to return.

So, if I understand correctly, that means that if you use `lift` to
specify a monadic action, there's no way to specify a different action
for cleanup. That probably implies that there is no sensible way to
convert a pipes-core pipe to a conduit pipe, at least not if you want
the finalization semantics to be preserved.

Thanks a lot for you reply!


More information about the Haskell-Cafe mailing list