Source code for standard typeclass instance declarations

hackage, haskell

Solution

I went looking in the Prelude, clicked on the source link for the `Ord` typeclass, scrolled down a little, and found that it's defined as

deriving instance (Ord a, Ord b) => Ord (a, b)

It's using the StandaloneDeriving extension. Basically it's generating the same code as if the type was defined as

data (a, b) = (a, b) deriving Ord

Problem

I was wondering about the `Ord` instance declaration for `(a,b)`, and I wanted to do a quick lookup on hackage to confirm my intuition that the comparison is first on `a` and then, in case of equality, on `b`. Specifically I went here. Since hackage has links to the source code for data declarations and functions, I assumed that there would also be source code for instance declarations, but I can't find them. Is there a reason why they are not there, or have I just not looked hard enough? `type Answer = Either Explanation Directions` :)

Original source