1. Bryan O'Sullivan
  2. text

Commits

Thomas M. DuBuisson  committed e1a138b

Use integer-simple if the integer-simple flag is set.

  • Participants
  • Parent commits a3aa2c4
  • Branches default

Comments (0)

Files changed (2)

File Data/Text/Lazy/Builder/Int.hs

View file
 #ifdef  __GLASGOW_HASKELL__
 # if __GLASGOW_HASKELL__ < 611
 import GHC.Integer.Internals
+# elif defined(INTEGER_GMP)
+import GHC.Integer.GMP.Internals
+# elif defined(INTEGER_SIMPLE)
+import GHC.Integer
 # else
-import GHC.Integer.GMP.Internals
+# error "You need to use either GMP or integer-simple."
 # endif
 #endif
 
-#ifdef INTEGER_GMP
+#if defined(INTEGER_GMP) || defined(INTEGER_SIMPLE)
 # define PAIR(a,b) (# a,b #)
 #else
 # define PAIR(a,b) (a,b)
 data T = T !Integer !Int
 
 integer :: Int -> Integer -> Builder
+#ifdef INTEGER_GMP
 integer 10 (S# i#) = decimal (I# i#)
 integer 16 (S# i#) = hexadecimal (I# i#)
+#else
+integer 10 i = decimal i
+integer 16 i = hexadecimal i
+#endif
 integer base i
     | i < 0     = singleton '-' <> go (-i)
     | otherwise = go i

File text.cabal

View file
   description: operate in developer mode
   default: False
 
+flag integer-simple
+  description: Use the simple integer library instead of GMP
+  default: False
+
 library
   c-sources: cbits/cbits.c
 
     cpp-options: -DASSERTS
 
   if impl(ghc >= 6.11)
-    cpp-options: -DINTEGER_GMP
-    build-depends: integer-gmp >= 0.2 && < 0.5
+    if flag(integer-simple)
+      cpp-options: -DINTEGER_SIMPLE
+      build-depends: integer-simple >= 0.1 && < 0.5
+    else
+      cpp-options: -DINTEGER_GMP
+      build-depends: integer-gmp >= 0.2 && < 0.5
+   
 
   if impl(ghc >= 6.9) && impl(ghc < 6.11)
     cpp-options: -DINTEGER_GMP