Hi,
I'm trying to write a function to convert a conduit to a Pipe (from
pipes-core), and I'm having trouble understanding why the `Finalize`
field in a `PipeM` constructor returns `r`. This makes it impossible
to create it from the corresponding `M` constructor in pipes-core,
since `M` includes an exception handler which is not guaranteed to run
fully, hence may not provide a return value. `HaveOutput` presents a
similar problem.

>From a cursory look at conduit's code, it doesn't look like the return
value of `Finalize` is ever used, and it seems that the conduits that
actually manage to define it either have `()` as return type or just
throw an exception. The definition of `lift` for the `MonadTrans`
instance duplicates the base monad action there, which doesn't look
quite right to me (isn't that supposed to contain a _cleanup_
action?).

Shouldn't the constructor be changed to something like `PipeM (m (Pipe
i o m r)) (Finalize m ())` or am I completely off base here?

Thanks.

BR,
Paolo

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to