[Haskell-cafe] Eq source code?
Liam Wall
liam.wall+haskell at gmail.com
Fri Apr 2 15:46:26 UTC 2021
That's description on what any instance is expected to adhere to, not
source.
You can check source links on stackable too:
https://www.stackage.org/haddock/lts-17.8/base-4.14.1.0/Data-Eq.html
On Fri, 2 Apr 2021, 16:38 Galaxy Being, <borgauf at gmail.com> wrote:
> 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-4.15.0.0/docs/Data-Eq.html> 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.,
>
> Reflexivity
> x == x = True
> Symmetry
> x == y = y == x
> Transitivity
> if x == y && y == z = True, then x == z = True
> Substitutivity
> if x == y = True and f is a "public" function whose return type is an
> instance of Eq, then f x == f y = True
> Negation
> 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?
>
> LB
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20210402/e707349d/attachment.html>
More information about the Haskell-Cafe
mailing list