Scott Turner <[EMAIL PROTECTED]> 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
_______________________________________________
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to