Given the definition

   const x _ = x

in the standard prelude, I have always assumed that the value of y was
not important when determining the value of (const x y).  What is the
value of (f [] []) where f is defined by:

>  f x y = const (show x == show y) w
>          where
>          w = ...

By equational reasoning, (f [] []) should be True, probably.  Of
course, [] == [] gives a type error when compiled, so maybe (f [] [])
could be undefined or raise a type error.  At least for the instances
of == that are defined in the Haskell standard prelude, it seems
reasonable to assume that expr1 == expr2 should never be False if expr1
and expr2 are equivalent by equational reasoning.

If w is defined by
>          w = x ++ y ++ ""
then (f [] []) = True, but if
>          w = (x ++ [5], y ++ "")
then (f [] []) = False.

Now in a procedural program, wouldn't we all complain if one expression
had the side effect of changing the value of another expression that
did not refer to the value of the first.  The expression (show x == show y)
doesn't refer to w, but this is the expression whose value may be True
or False or undefined.

Warren Burton
Simon Fraser University

Reply via email to