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

Johan Tibell johan.tibell at gmail.com
Mon Apr 28 20:37:08 UTC 2014


+1


On Mon, Apr 28, 2014 at 10:36 PM, Niklas Hambüchen <mail at nh2.me> wrote:

> 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 --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/libraries/attachments/20140428/2cc0b92b/attachment.html>


More information about the Libraries mailing list