[Haskell-cafe] Eq source code?

Galaxy Being borgauf at gmail.com
Fri Apr 2 15:37:07 UTC 2021

While learning about type classes, I tried to find the actual source code
for Eq. In my beginner books this much is typically given

class Eq a where
  (==), (/=) :: a -> a -> Bool

-- Minimal completion definition:
  x /= y = not (x == y)
  x == y = not (x /= y)

I then found this
<https://hackage.haskell.org/package/base-> at
hackage.haskell.org, but the "source" links are dead. On this page is a
section of what I can't tell is either source code or just commentary on
all the different mathematical ideas about equality, i.e.,

x == x = True
x == y = y == x
if x == y && y == z = True, then x == z = True
if x == y = True and f is a "public" function whose return type is an
instance of Eq, then f x == f y = True
x /= y = not (x == y)

I would like to know if this is indeed in the source code or if it's just a
sort of commentary. It looks important. Where can I find the actual source
for all these basic type classes?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20210402/cfff9b88/attachment.html>

More information about the Haskell-Cafe mailing list