On 2012-07-24 10:10, Christian Sternagel wrote:
Dear all,
with respect to formal verification of Haskell code I was wondering whether (==)
of the Eq class is intended to be commutative (for many classes such
requirements are informally stated in their description, since Eq does not have
such a statement, I'm asking here). Or are there any known cases where
commutativity of (==) is violated (due to strictness issues)?
Strictness plays no role for Eq, since to test for equality both sides will have
to be fully evaluated. I think (==) is supposed to be equivalence relation,
which is symmetric (i.e. commutative); as well as reflexive and transitive.
There are some cases of (==) not being reflexive, Floats being the most notable
one, but many people consider that to be a bug. I can't think of any instances
that violate symmetry.
Twan
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe