On Mon, 6 Apr 2009, Stephan Friedrichs wrote:

Hello,

is there a monad transformer to consume an input list? I've got external
events "streaming into the monad" that are consumed on demand and I'm
not sure if there's something better than a StateT.

I wondered that, too. I wondered whether there is something inverse to Writer, and Reader is appearently not the answer. Now I think, that State is indeed the way to go to consume a list. Even better is StateT List Maybe:

next :: StateT [a] Maybe a
next = StateT Data.List.HT.viewL   -- see utility-ht package
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to