From b40cf1d33ed4f7da5b4edf0eff8251d30e32f137 Mon Sep 17 00:00:00 2001 From: Ian Lynagh Date: Tue, 24 Nov 2009 13:36:39 +0000 Subject: [PATCH] De-orphan the Eq/Ord Integer instances --- GHC/Classes.hs | 12 ++++++++++++ GHC/Num.lhs | 21 --------------------- 2 files changed, 12 insertions(+), 21 deletions(-) diff --git a/GHC/Classes.hs b/GHC/Classes.hs index c1532f2..30f706a 100644 --- a/GHC/Classes.hs +++ b/GHC/Classes.hs @@ -20,6 +20,7 @@ module GHC.Classes where import GHC.Bool +import GHC.Integer -- GHC.Magic is used in some derived instances import GHC.Magic () import GHC.Ordering @@ -96,6 +97,10 @@ instance Eq Char where (C# c1) == (C# c2) = c1 `eqChar#` c2 (C# c1) /= (C# c2) = c1 `neChar#` c2 +instance Eq Integer where + (==) = eqInteger + (/=) = neqInteger + -- | The 'Ord' class is used for totally ordered datatypes. -- -- Instances of 'Ord' can be derived for any user-defined @@ -184,6 +189,13 @@ instance Ord Char where (C# c1) <= (C# c2) = c1 `leChar#` c2 (C# c1) < (C# c2) = c1 `ltChar#` c2 +instance Ord Integer where + (<=) = leInteger + (>) = gtInteger + (<) = ltInteger + (>=) = geInteger + compare = compareInteger + -- OK, so they're technically not part of a class...: -- Boolean functions diff --git a/GHC/Num.lhs b/GHC/Num.lhs index 87a11df..9a81c90 100644 --- a/GHC/Num.lhs +++ b/GHC/Num.lhs @@ -122,27 +122,6 @@ divModInt x@(I# _) y@(I# _) = (x `divInt` y, x `modInt` y) %********************************************************* %* * -\subsection{The @Integer@ instances for @Eq@, @Ord@} -%* * -%********************************************************* - -\begin{code} -instance Eq Integer where - (==) = eqInteger - (/=) = neqInteger - ------------------------------------------------------------------------- -instance Ord Integer where - (<=) = leInteger - (>) = gtInteger - (<) = ltInteger - (>=) = geInteger - compare = compareInteger -\end{code} - - -%********************************************************* -%* * \subsection{The @Integer@ instances for @Show@} %* * %********************************************************* -- 1.7.10.4