summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2009-07-22 01:31:51 +0000
committerIan Lynagh <igloo@earth.li>2009-07-22 01:31:51 +0000
commit14ca5740ee951dc68b59ebaff8a4a6315436333f (patch)
tree1e5ce827e448a009824d60ad3ecf011afa174d0c
parent50d019531574c5e78d83a61861255cfeae52de32 (diff)
downloadhaskell-14ca5740ee951dc68b59ebaff8a4a6315436333f.tar.gz
Add integer-simple as a build option
-rw-r--r--libraries/base/GHC/Real.lhs2
-rw-r--r--libraries/base/base.cabal9
2 files changed, 10 insertions, 1 deletions
diff --git a/libraries/base/GHC/Real.lhs b/libraries/base/GHC/Real.lhs
index 6a3f335b0c..f4d3e5e5e3 100644
--- a/libraries/base/GHC/Real.lhs
+++ b/libraries/base/GHC/Real.lhs
@@ -449,6 +449,7 @@ lcm _ 0 = 0
lcm 0 _ = 0
lcm x y = abs ((x `quot` (gcd x y)) * y)
+#ifdef OPTIMISE_INTEGER_GCD_LCM
{-# RULES
"gcd/Int->Int->Int" gcd = gcdInt
"gcd/Integer->Integer->Integer" gcd = gcdInteger'
@@ -465,6 +466,7 @@ gcdInteger' a b = gcdInteger a b
gcdInt :: Int -> Int -> Int
gcdInt 0 0 = error "GHC.Real.gcdInt: gcd 0 0 is undefined"
gcdInt a b = fromIntegral (gcdInteger (fromIntegral a) (fromIntegral b))
+#endif
integralEnumFrom :: (Integral a, Bounded a) => a -> [a]
integralEnumFrom n = map fromInteger [toInteger n .. toInteger (maxBound `asTypeOf` n)]
diff --git a/libraries/base/base.cabal b/libraries/base/base.cabal
index f94f18564c..01fad6838d 100644
--- a/libraries/base/base.cabal
+++ b/libraries/base/base.cabal
@@ -23,9 +23,16 @@ source-repository head
type: darcs
location: http://darcs.haskell.org/packages/base/
+Flag integer-simple
+ Description: Use integer-simple
+
Library {
if impl(ghc) {
- build-depends: integer-gmp
+ if flag(integer-simple)
+ build-depends: integer-simple
+ else
+ build-depends: integer-gmp
+ ghc-options: -DOPTIMISE_INTEGER_GCD_LCM
build-depends: rts, ghc-prim
exposed-modules:
Foreign.Concurrent,