strictness question
S. Doaitse Swierstra
doaitse@cs.uu.nl
Thu, 1 Mar 2001 12:25:33 +0100
I ran into a difference between GHC and Hugs. The following code:
f (P p) ~(P q) = P (\ k -> \inp -> let (((pv, (qv, r)), m), st) =
p (q k) inp
in (((pv qv , r ), m), st))
runs fine with Hugs but blows up with GHC, whereas:
f (P p) ~(P q) = P (\ k -> \inp -> let ~(~(~(pv, ~(qv, r)), m),
st) = p (q k) inp
in (((pv qv , r ), m), st))
runs fine with GHC too.
From the Haskell manual I understand that pattern matching in "let"'s
should be done lazily, so the addition of a collection of ~'s should
not make a difference. Am I right with this interpretation?
A possible source of this problem may be origination from the smarter
GHC optimiser, but in that case the optimiser is not doing its work
well.
Doaitse Swierstra
--
__________________________________________________________________________
S. Doaitse Swierstra, Department of Computer Science, Utrecht University
P.O.Box 80.089, 3508 TB UTRECHT, the Netherlands
Mail: mailto:doaitse@cs.uu.nl
WWW: http://www.cs.uu.nl/
PGP Public Key: http://www.cs.uu.nl/people/doaitse/
tel: +31 (30) 253 3962, fax: +31 (30) 2513791
__________________________________________________________________________