3 Mar
2005
3 Mar
'05
2:45 p.m.
Scott Turner <p.turner@computer.org> writes:
Is the behavior of evaluating z unspecified? z = f (0, z) f x = case x of (1,1) -> z _ -> 0 Hugs and GHC agree that z evaluates to 0. However, if the first line is changed to z = f (z,0) then both implementations loop. In other words, the behavior depends on order of evaluation, which AFAIK is not specified.
Patterns are matched left-to-right, which fully explains the behaviour you see. Haskell Report section 3.17.2, Informal Semantics of Pattern Matching Regards, Malcolm