summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2011-09-17 18:23:16 +0100
committerIan Lynagh <igloo@earth.li>2011-09-17 18:23:16 +0100
commitee727e863ffb8064359ddecb770e72c928c69d13 (patch)
treedb9f78e2980f694461a962a6877cd3f108ba3351
parentf9dad24ec251c6a422c901c93b9a63f7aa343bb2 (diff)
downloadhaskell-ee727e863ffb8064359ddecb770e72c928c69d13.tar.gz
Don't define our own list type
We can now use [] as it has been moved to ghc-prim.
-rw-r--r--libraries/integer-simple/GHC/Integer/Type.hs15
1 files changed, 6 insertions, 9 deletions
diff --git a/libraries/integer-simple/GHC/Integer/Type.hs b/libraries/integer-simple/GHC/Integer/Type.hs
index f5cdea3fd5..8bc530afd6 100644
--- a/libraries/integer-simple/GHC/Integer/Type.hs
+++ b/libraries/integer-simple/GHC/Integer/Type.hs
@@ -42,15 +42,12 @@ data Integer = Positive !Positive | Negative !Positive | Naught
-- Positive's have the property that they contain at least one Bit,
-- and their last Bit is One.
type Positive = Digits
-type Positives = List Positive
+type Positives = [Positive]
data Digits = Some !Digit !Digits
| None
type Digit = Word#
--- XXX Could move [] above us
-data List a = Nil | Cons a (List a)
-
mkInteger :: Bool -- non-negative?
-> [Int] -- absolute value in 31 bit chunks, least significant first
-- ideally these would be Words rather than Ints, but
@@ -743,9 +740,9 @@ quotRemPositive :: Positive -> Positive -> (# Integer, Integer #)
subtractors = mkSubtractors (WORD_SIZE_IN_BITS# -# 1#)
mkSubtractors (!n) = if n ==# 0#
- then Cons ys Nil
- else Cons (ys `smallShiftLPositive` n)
- (mkSubtractors (n -# 1#))
+ then [ys]
+ else (ys `smallShiftLPositive` n)
+ : (mkSubtractors (n -# 1#))
-- The main function. Go the the end of xs, then walk
-- back trying to divide the number we accumulate by ys.
@@ -761,8 +758,8 @@ quotRemPositive :: Positive -> Positive -> (# Integer, Integer #)
(# some d ds, m'' #)
g :: Digit -> Positives -> Digits -> (# Digit, Digits #)
- g (!d) Nil (!m) = (# d, m #)
- g (!d) (Cons sub subs) (!m)
+ g (!d) [] (!m) = (# d, m #)
+ g (!d) (sub : subs) (!m)
= case d `uncheckedShiftL#` 1# of
d' ->
case m `comparePositive` sub of