On Nov 5, 2012 2:42 PM, "Hiromi ISHII" <konn.jinro@gmail.com> wrote:
>
> Hi, there
>
> On 2012/11/01, at 21:23, Michael Snoyman wrote:
>
> > Due to various technical reasons regarding the nature of conduit, you can't currently catch exceptions within the Pipe monad. You have two options:
> >
> > * Catch exceptions before `lift`ing.
> > * Catch exceptions thrown from the entire Pipe.
> >
> > Since the exceptions are always originating in the underlying monad, the first choice is certainly possible in theory, though may require reworking the library you're using a bit.
>
> Thanks. In my case, used library is relatively small so I can rewrite it to ignore exception before lifting.
> But I think it is more convenient doing the same thing without modifying existing code.
>
> The second choice does not match my case because it cannot resume the process from the place just after an exception occurred.

I agree that it would be great if conduit could meet your use case better. I haven't spent enough cycles looking at this yet to determine if the reason we don't have this support is a limitation in the conduit approach itself, or just a limitation in what I was able to implement so far. If you can think of a way to implement more fine-grained exception handling (or anyone else for that matter), I'd love to hear about it.

> > One other possibility that I haven't actually tried would be to use transPipe[1] to catch all of the exceptions, though I'm not sure how well that would work in practice.
>
> The type of the first argument of `transPipe` should be general, so I think we can't compose it with `catch` function.

That makes sense.

> -- Hiromi ISHII
> konn.jinro@gmail.com
>
>
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe