Am Donnerstag 04 März 2010 04:20:05 schrieb Louis Wasserman: > James, > > Which version of Control.Monad.State are you importing? > > If you're just importing vanilla Control.Monad.State, that's actually > sending you to Control.Monad.State.Lazy. > > Using Control.Monad.State.Strict might solve your problems, srsly. > Laziness can result in epically failing memory leaks.
That was my first thought too, but for this code, Control.Monad.State.Lazy is the better choice. Control.Monad.State.Strict doesn't play too well with sequence (and hence mapM). Since James consumes the list of chain lengths as it is produced (key = maximum keys), no large thunks can build up. With the strict State, he can't start to look for the maximum until all chain lengths have been computed, building a big fat thunk for the list. > > Louis Wasserman > wasserman.lo...@gmail.com > http://profiles.google.com/wasserman.louis _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe