[Haskell-cafe] Monad strictness
Wolfgang Jeltsch
wolfgang at jeltsch.net
Mon Nov 21 10:22:41 EST 2005
Am Montag, 21. November 2005 16:09 schrieb Roberto Zunino:
> Yitzchak Gale wrote:
> > In the following, why does testA work and testB diverge?
> > Where is the strictness coming from?
>
> My guess: from strict pattern matching in (>>=).
This is a problem I came across some months ago. State uses lazy pattern
matching (implicitely via a let expression) while StateT uses strict pattern
matching (inside a do statement). Both should definitely use lazy pattern
matching, in my opinion.
> [...]
> The following StateT variant uses lazy (irrefutable) pattern match instead.
Good! :-)
> Regards,
> Roberto Zunino.
> [...]
Best wishes,
Wolfgang
More information about the Haskell-Cafe
mailing list