Proposal: Add modify' to Control.Monad.State.Strict

Roman Cheplyaka roma at ro-che.info
Tue Apr 29 05:47:46 UTC 2014


+1

* Niklas Hambüchen <mail at nh2.me> [2014-04-28 21:36:02+0100]
> Code like
> 
>    flip execState 0 (forever $ modify (+1))
> 
> leaks memory as hell, and gets fixed by using
> 
>   x <- get
>   put $! x + 1
> 
> I propose the addition of modify' to Control.Monad.State.Strict.
> 
> This seems useful for the strict state monad and is consistent with
> similar functions in base (such as modifyIORef').
> 
> Discussion period: 2 weeks.
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://www.haskell.org/mailman/listinfo/libraries
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://www.haskell.org/pipermail/libraries/attachments/20140429/940d3445/attachment.sig>


More information about the Libraries mailing list