[Haskell-cafe] Re: Long running Haskell program

Felipe Lessa felipe.lessa at gmail.com
Thu Nov 12 05:48:31 EST 2009


On Thu, Nov 12, 2009 at 8:01 AM, Matthew Pocock
<matthew.pocock at ncl.ac.uk> wrote:
> Yes. This bit me the first time I came across it. I think we need a
> Control.Monad.State.StrictOnState with strict behaviour on the state value.
> I notice this same underlying issue is coming up in more than one thread on
> these lists.

This monad would indeed be useful, however it may be confusing as
well.  For example, if you are inserting elements in a Map using a
lazy insert, seq'ing the map will only reduce it to WHNF (of course)
and move the insertion down one level in the tree.  IOW, I'd guess
that OP's problem can't be solved just by seq'ing the map, he would
have to use strict operations.  There's a strict insertWith in
Data.Map, but IIRC it's strict only on its combining operation, not on
the insertion itself.

Hmmm... maybe Control.Monad.State.RnfOnState? =P

Cheers,

-- 
Felipe.


More information about the Haskell-Cafe mailing list