[prev in list] [next in list] [prev in thread] [next in thread] 

List:       haskell-cafe
Subject:    Re: [Haskell-cafe] conduit: Finalize field in PipeM
From:       Paolo Capriotti <p.capriotti () gmail ! com>
Date:       2012-05-04 16:51:11
Message-ID: CALMmMjZhtL4oqeRFGOOJpk7rc8ZL74YaM7T0xvMTBo24tJgQCw () mail ! gmail ! com
[Download RAW message or body]

On Fri, May 4, 2012 at 9:40 AM, Michael Snoyman <michael@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!

BR,
Paolo

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic