summaryrefslogtreecommitdiff
path: root/libraries/integer-simple/GHC/Integer.hs
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2011-07-22 20:29:05 +0100
committerIan Lynagh <igloo@earth.li>2011-07-22 20:29:05 +0100
commitd4d30941e25b40a816b7069e97d76c5387d901cf (patch)
tree15386fea907098fa602ad37ab71e4b328bc446b2 /libraries/integer-simple/GHC/Integer.hs
parent17f1654367b96b9dfeb44b91ab4d1214d38b2ad1 (diff)
downloadhaskell-d4d30941e25b40a816b7069e97d76c5387d901cf.tar.gz
Follow library changes
Diffstat (limited to 'libraries/integer-simple/GHC/Integer.hs')
-rw-r--r--libraries/integer-simple/GHC/Integer.hs14
1 files changed, 14 insertions, 0 deletions
diff --git a/libraries/integer-simple/GHC/Integer.hs b/libraries/integer-simple/GHC/Integer.hs
index 7c21dcaffa..118e0c6656 100644
--- a/libraries/integer-simple/GHC/Integer.hs
+++ b/libraries/integer-simple/GHC/Integer.hs
@@ -2,6 +2,8 @@
{-# LANGUAGE CPP, MagicHash, ForeignFunctionInterface,
NoImplicitPrelude, BangPatterns, UnboxedTuples,
UnliftedFFITypes #-}
+-- TODO: Get rid of orphan instances
+{-# OPTIONS_GHC -fno-warn-orphans #-}
-----------------------------------------------------------------------------
-- |
@@ -40,6 +42,7 @@ module GHC.Integer (
import GHC.Integer.Type
+import GHC.Classes
import GHC.Ordering
import GHC.Prim
import GHC.Types
@@ -371,6 +374,10 @@ x `neqInteger` y = case x `compareInteger` y of
EQ -> False
_ -> True
+instance Eq Integer where
+ (==) = eqInteger
+ (/=) = neqInteger
+
ltInteger :: Integer -> Integer -> Bool
x `ltInteger` y = case x `compareInteger` y of
LT -> True
@@ -391,6 +398,13 @@ x `geInteger` y = case x `compareInteger` y of
LT -> False
_ -> True
+instance Ord Integer where
+ (<=) = leInteger
+ (>) = gtInteger
+ (<) = ltInteger
+ (>=) = geInteger
+ compare = compareInteger
+
absInteger :: Integer -> Integer
absInteger (Negative x) = Positive x
absInteger x = x