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

Anthony Cowley acowley at seas.upenn.edu
Mon Apr 28 21:20:40 UTC 2014



> On Apr 28, 2014, at 5:02 PM, Darius Jahandarie <djahandarie at gmail.com> wrote:
> 
> +1. I've defined this practically every time I've used the strict state monad.
> 
> -- 
> Darius Jahandarie (Mobile)

Likewise, +1

Anthony


> 
>> On Apr 28, 2014, at 3: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
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://www.haskell.org/mailman/listinfo/libraries


More information about the Libraries mailing list