2011/11/16 Johan Tibell <johan.tib...@gmail.com>: > On Wed, Nov 16, 2011 at 2:23 PM, Jason Dusek <jason.du...@gmail.com> wrote: >> Tried a modifySTRef' defined this way: >> >> modifySTRef' ref f = do >> val <- (f $!!) <$> readSTRef ref >> writeSTRef ref (val `seq` val) >> >> ...but there was no change in memory usage. > > Why not just > > modifySTRef :: STRef s a -> (a -> a) -> ST s () > modifySTRef ref f = do > x <- readSTRef ref > writeSTRef ref $! f x > > (Note that I didn't check if modifySTRef was actually a problem in this > case).
I just didn't want to miss an opportunity to put in extra strictness annotations! School of redundancy school. -- Jason Dusek () ascii ribbon campaign - against html e-mail /\ www.asciiribbon.org - against proprietary attachments _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe