[commit: packages/containers] ghc-head: Allow compilation of Data.IntSet.Base without cabal. (d276454)

git at git.haskell.org git at git.haskell.org
Fri Aug 30 13:34:22 CEST 2013


Repository : ssh://git@git.haskell.org/containers

On branch  : ghc-head
Link       : http://git.haskell.org/?p=packages/containers.git;a=commit;h=d2764542ee185575b567757ba124ff1a96883f77

>---------------------------------------------------------------

commit d2764542ee185575b567757ba124ff1a96883f77
Author: Milan Straka <fox at ucw.cz>
Date:   Sun Nov 11 10:39:06 2012 +0100

    Allow compilation of Data.IntSet.Base without cabal.
    
    Use generic definition of bitcount when MIN_VERSION_base is undefined.


>---------------------------------------------------------------

d2764542ee185575b567757ba124ff1a96883f77
 Data/IntSet/Base.hs |   15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/Data/IntSet/Base.hs b/Data/IntSet/Base.hs
index 11452d5..7aec215 100644
--- a/Data/IntSet/Base.hs
+++ b/Data/IntSet/Base.hs
@@ -1496,8 +1496,21 @@ foldr'Bits prefix f z bm = let lb = lowestBitSet bm
     by Peter Wegner in CACM 3 (1960), 322. (Also discovered independently by
     Derrick Lehmer and published in 1964 in a book edited by Beckenbach.)"
 ----------------------------------------------------------------------}
-bitcount :: Int -> Word -> Int
+
+-- We want to be able to compile without cabal. Nevertheless
+-- #if defined(MIN_VERSION_base) && MIN_VERSION_base(4,5,0)
+-- does not work, because if MIN_VERSION_base is undefined,
+-- the last condition is syntactically wrong.
+#define MIN_VERSION_base_4_5_0 0
+#ifdef MIN_VERSION_base
 #if MIN_VERSION_base(4,5,0)
+#undef MIN_VERSION_base_4_5_0
+#define MIN_VERSION_base_4_5_0 1
+#endif
+#endif
+
+bitcount :: Int -> Word -> Int
+#if MIN_VERSION_base_4_5_0
 bitcount a x = a + popCount x
 #else
 bitcount a0 x0 = go a0 x0





More information about the ghc-commits mailing list