De-orphan the Eq/Ord Integer instances
authorIan Lynagh <igloo@earth.li>
Tue, 24 Nov 2009 13:36:39 +0000 (13:36 +0000)
committerIan Lynagh <igloo@earth.li>
Tue, 24 Nov 2009 13:36:39 +0000 (13:36 +0000)
GHC/Classes.hs
GHC/Num.lhs

index c1532f2..30f706a 100644 (file)
@@ -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
index 87a11df..9a81c90 100644 (file)
@@ -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@}
 %*                                                      *
 %*********************************************************