Skip to content
Browse files

Remove support for compilers other than GHC

There are no other compilers.
  • Loading branch information...
1 parent 8990fae commit 414a8ee0756e010fb69b248f9f0de19ac4fd87b2 @tibbe committed
Showing with 4 additions and 26 deletions.
  1. +2 −15 Data/HashMap/Base.hs
  2. +2 −11 Data/HashSet.hs
View
17 Data/HashMap/Base.hs
@@ -79,11 +79,13 @@ import Control.Applicative ((<$>), Applicative(pure))
import Control.DeepSeq (NFData(rnf))
import Control.Monad.ST (ST)
import Data.Bits ((.&.), (.|.), complement)
+import Data.Data hiding (Typeable)
import qualified Data.Foldable as Foldable
import qualified Data.List as L
import Data.Monoid (Monoid(mempty, mappend))
import Data.Traversable (Traversable(..))
import Data.Word (Word)
+import GHC.Exts ((==#), build, reallyUnsafePtrEquality#)
import Prelude hiding (filter, foldr, lookup, map, null, pred)
import qualified Data.HashMap.Array as A
@@ -94,11 +96,6 @@ import Data.HashMap.Unsafe (runST)
import Data.HashMap.UnsafeShift (unsafeShiftL, unsafeShiftR)
import Data.Typeable (Typeable)
-#if defined(__GLASGOW_HASKELL__)
-import Data.Data hiding (Typeable)
-import GHC.Exts ((==#), build, reallyUnsafePtrEquality#)
-#endif
-
------------------------------------------------------------------------
-- | Convenience function. Compute a hash value for the given value.
@@ -143,7 +140,6 @@ instance (Eq k, Hashable k) => Monoid (HashMap k v) where
mappend = union
{-# INLINE mappend #-}
-#if __GLASGOW_HASKELL__
instance (Data k, Data v, Eq k, Hashable k) => Data (HashMap k v) where
gfoldl f z m = z fromList `f` toList m
toConstr _ = fromListConstr
@@ -158,7 +154,6 @@ fromListConstr = mkConstr hashMapDataType "fromList" [] Prefix
hashMapDataType :: DataType
hashMapDataType = mkDataType "Data.HashMap.Base.HashMap" [fromListConstr]
-#endif
type Hash = Word
type Bitmap = Word
@@ -897,11 +892,7 @@ elems = L.map snd . toList
-- | /O(n)/ Return a list of this map's elements. The list is
-- produced lazily.
toList :: HashMap k v -> [(k, v)]
-#if defined(__GLASGOW_HASKELL__)
toList t = build (\ c z -> foldrWithKey (curry c) z t)
-#else
-toList = foldrWithKey (\ k v xs -> (k, v) : xs) []
-#endif
{-# INLINE toList #-}
-- | /O(n)/ Construct a map with the supplied mappings. If the list
@@ -1080,9 +1071,5 @@ fullNodeMask = complement (complement 0 `unsafeShiftL` maxChildren)
-- | Check if two the two arguments are the same value. N.B. This
-- function might give false negatives (due to GC moving objects.)
ptrEq :: a -> a -> Bool
-#if defined(__GLASGOW_HASKELL__)
ptrEq x y = reallyUnsafePtrEquality# x y ==# 1#
-#else
-ptrEq _ _ = False
-#endif
{-# INLINE ptrEq #-}
View
13 Data/HashSet.hs
@@ -60,20 +60,17 @@ module Data.HashSet
) where
import Control.DeepSeq (NFData(..))
+import Data.Data hiding (Typeable)
import Data.HashMap.Base (HashMap, foldrWithKey)
import Data.Hashable (Hashable)
import Data.Monoid (Monoid(..))
+import GHC.Exts (build)
import Prelude hiding (filter, foldr, map, null)
import qualified Data.Foldable as Foldable
import qualified Data.HashMap.Lazy as H
import qualified Data.List as List
import Data.Typeable (Typeable)
-#if defined(__GLASGOW_HASKELL__)
-import Data.Data hiding (Typeable)
-import GHC.Exts (build)
-#endif
-
-- | A set of values. A set cannot contain duplicate values.
newtype HashSet a = HashSet {
asMap :: HashMap a ()
@@ -103,7 +100,6 @@ instance (Show a) => Show (HashSet a) where
showsPrec d m = showParen (d > 10) $
showString "fromList " . shows (toList m)
-#if __GLASGOW_HASKELL__
instance (Data a, Eq a, Hashable a) => Data (HashSet a) where
gfoldl f z m = z fromList `f` toList m
toConstr _ = fromListConstr
@@ -118,7 +114,6 @@ fromListConstr = mkConstr hashSetDataType "fromList" [] Prefix
hashSetDataType :: DataType
hashSetDataType = mkDataType "Data.HashSet" [fromListConstr]
-#endif
-- | /O(1)/ Construct an empty set.
empty :: HashSet a
@@ -219,11 +214,7 @@ filter p = HashSet . H.filterWithKey q . asMap
-- | /O(n)/ Return a list of this set's elements. The list is
-- produced lazily.
toList :: HashSet a -> [a]
-#if defined(__GLASGOW_HASKELL__)
toList t = build (\ c z -> foldrWithKey ((const .) c) z (asMap t))
-#else
-toList = foldrWithKey (\ k _ xs -> k : xs) [] . asMap
-#endif
{-# INLINE toList #-}
-- | /O(n*min(W, n))/ Construct a set from a list of elements.

0 comments on commit 414a8ee

Please sign in to comment.
Something went wrong with that request. Please try again.