[Haskell-cafe] Guide for converting existing code to Conduit 0.4?

Michael Snoyman michael at snoyman.com
Mon Apr 9 12:54:05 CEST 2012


On Mon, Apr 9, 2012 at 12:58 PM, Erik de Castro Lopo
<mle+hs at mega-nerd.com> wrote:
> Hi all,
>
> Is there some sort of a guide for converting existing code Conduit 0.4?
>
> What happened to Control.Monad.Trans.Resource.with?
>
> What happens to stuff that used to to have a type "C.Source m a" which
> now seems to need type "C.Pipe Void a (ResourceT m) a"?

Hmm... I'd be surprised if you really need the Pipe signature that
you're providing. That would mean that you are providing an output
stream of `a`, PLUS a final result of `a`. Most likely, what you want
is:

    Pipe Void a (ResourceT m) ()

which would be identical to:

    Source (ResourceT m) a

The recommended approach though would be more like:

    MonadResource m => Source m a

Since that gives more flexibility about where in your monad stack you
place the ResourceT.

Michael

>
> Cheers,
> Erik
> --
> ----------------------------------------------------------------------
> Erik de Castro Lopo
> http://www.mega-nerd.com/
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe



More information about the Haskell-Cafe mailing list