Proposal: add 'state' to the MonadState class

Julian Bean jules at jellybean.co.uk
Wed Sep 28 08:03:00 CEST 2011


On 26 Sep 2011, at 15:50, Edward Kmett wrote:

> 
> >    class MonadState s m | m -> s where
> >        ...
> >        state :: (s -> (a,s)) -> m a
> >        state f = do s <- get
> >                     let (a,s') = f s
> >                     set s'
> >                     return a
> >
> 
> I am 100% behind this change. 
> 
> It has been on the short list of changes that I want to make to mtl.

(+1)



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/libraries/attachments/20110928/73a4cce4/attachment.htm>


More information about the Libraries mailing list