[web-devel] [conduit 0.2.x] generalizing sourceIO?

Erik de Castro Lopo mle+hs at mega-nerd.com
Tue Feb 7 22:17:08 CET 2012


Bardur Arantsson wrote:

> Hi all,
> 
> I was just wondering - would it be reasonable to generalize
> 
>     sourceIO :: ResourceIO m
>            => IO state
>            -> (state -> IO ())
>            -> (state -> m (SourceIOResult output))
>            -> Source m output
> 
> to
> 
>     sourceIO :: ResourceIO m
>            => IO state
>            -> (state -> IO ())
>            -> (state -> m (state, SourceIOResult output))
>            -> Source m output
> 
> so that the state could be "updated" while producing results?

Would it not be possible to achieve what you want with sourceState:

    http://hackage.haskell.org/packages/archive/conduit/0.2.0/doc/html/Data-Conduit.html#v:sourceState

Erik
-- 
----------------------------------------------------------------------
Erik de Castro Lopo
http://www.mega-nerd.com/



More information about the web-devel mailing list