%
-% (c) The GRASP Project, Glasgow University, 1994-1995
+% (c) The GRASP Project, Glasgow University, 1994-1998
%
\section[BitSet]{An implementation of very small sets}
module BitSet (
BitSet, -- abstract type
mkBS, listBS, emptyBS, unitBS,
- unionBS, minusBS
-#if ! defined(COMPILING_GHC)
- , elementBS, intersectBS, isEmptyBS
-#endif
+ unionBS, minusBS, intBS
) where
#ifdef __GLASGOW_HASKELL__
-#if __GLASGOW_HASKELL__ >= 202
import GlaExts
-#endif
-- nothing to import
#elif defined(__YALE_HASKELL__)
{-hide import from mkdependHS-}
minusBS :: BitSet -> BitSet -> BitSet
minusBS (MkBS x#) (MkBS y#) = MkBS (x# `and#` (not# y#))
-#if ! defined(COMPILING_GHC)
+#if 0
-- not used in GHC
isEmptyBS :: BitSet -> Bool
isEmptyBS (MkBS s#)
_ -> n : more
shiftr x y = shiftRL# x y
+-- intBS is a bit naughty.
+intBS :: BitSet -> Int
+intBS (MkBS w#) = I# (word2Int# w#)
+
#elif defined(__YALE_HASKELL__)
data BitSet = MkBS Int
unionBS :: BitSet -> BitSet -> BitSet
unionBS (MkBS x) (MkBS y) = MkBS (x `logiorInt` y)
-#if ! defined(COMPILING_GHC)
+#if 0
-- not used in GHC
isEmptyBS :: BitSet -> Bool
isEmptyBS (MkBS s)
unionBS :: BitSet -> BitSet -> BitSet
unionBS (MkBS x) (MkBS y) = MkBS (x `bitOr` y)
-#if ! defined(COMPILING_GHC)
+#if 0
-- not used in GHC
isEmptyBS :: BitSet -> Bool
isEmptyBS (MkBS s)