This is the standard implementation of these methods, and yes, it is round. If you use them as-is, youll loop:
data Foo = Foo instance Eq Foo
> Foo == Foo ^CInterrupted
Circular definitions exist, so you can implement (==) and get (/=) for free, or vice versa:
data Foo = Foo instance Eq Foo where x == y = True
> Foo /= Foo False
See also the Ord class, which explains that the minimum complete definition in this particular case.
source share