[Haskell-cafe] Is (==) commutative?

Jonas Almström Duregård jonas.duregard at chalmers.se
Tue Jul 24 14:39:41 CEST 2012


I suppose you need to define what commutativity means in the presence
of undefined values. For instance if error "0" is different from error
"1" then you do not have commutativity. Also nontermination needs to
be considered, for instance "(fix $ \x->x) == undefined" typically
fails to terminate but "undefined == (fix $ \x->x)" typically yields
an error.


On 24 July 2012 10:10, Christian Sternagel <c.sternagel at gmail.com> 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)?
> cheers
> chris
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe

More information about the Haskell-Cafe mailing list