Bug in Control.Monad.State

Yitzchak Gale gale at sefer.org
Wed Nov 23 07:16:31 EST 2005

On Wed, Nov 23, 2005 at 10:58:55AM +0100, Udo Stenzel wrote:
> I was thinking of the state component, and I maintain that it should be
> strict.  Rationale: if the state is some primitive type, you want it
> strict anyway.  If it isn't, the strictness doesn't cost much anyway.
> If it's still wrong, wrapping in a constructor helps.

I can see your point. But we have to be careful;
this kind of thing adds complexity to the
language, making Haskell harder to learn and
programs harder to understand.

My intuition tells me:

- Things directly related to IO are strict. E.g.,
  IO, ST, file operations, threads, etc.

- Things marked explicitly as being strict are
  strict.  E.g., seq, $!, StrictState,
  Data.Map.StrictMap, etc.

- Everything else is lazy - because Haskell is lazy!

I think that is pretty much the case today.

That may not always be optimal, as you point out.
But it sure makes it much easier for me do work
in Haskell on a day to day basis.


More information about the Libraries mailing list