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

Bardur Arantsson spam at scientician.net
Tue Feb 7 21:57:54 CET 2012


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?

I've found there are a few situations where the lack of "state 
threading" is forcing me to use MVars where it would actually be a lot 
nicer and simpler to just thread an accumulator.

AFAICT from the sourceIO implementation there shouldn't really be any 
problem with doing this. Am I overlooking something?

Regards,




More information about the web-devel mailing list