@@ -149,6 +149,9 @@ module Data.HashMap.Internal
149149 , adjust #
150150 ) where
151151
152+ import Data.Traversable -- MicroHs needs this since its Prelude does not have Foldable&Traversable.
153+ -- It's harmless for GHC, and putting it first avoid a warning.
154+
152155import Control.Applicative (Const (.. ))
153156import Control.DeepSeq (NFData (.. ), NFData1 (.. ), NFData2 (.. ))
154157import Control.Monad.ST (ST , runST )
@@ -192,9 +195,11 @@ data Leaf k v = L !k v
192195instance (NFData k , NFData v ) => NFData (Leaf k v ) where
193196 rnf (L k v) = rnf k `seq` rnf v
194197
198+ #if defined(__GLASGOW_HASKELL__)
195199-- | @since 0.2.17.0
196200instance (TH. Lift k , TH. Lift v ) => TH. Lift (Leaf k v ) where
197201 liftTyped (L k v) = [|| L k $! v || ]
202+ #endif
198203
199204-- | @since 0.2.14.0
200205instance NFData k => NFData1 (Leaf k ) where
@@ -701,7 +706,11 @@ lookupRecordCollision# h k m =
701706-- this whole thing is always inlined, we don't have to worry about
702707-- any extra CPS overhead.
703708lookupCont ::
709+ #if defined(__GLASGOW_HASKELL__)
704710 forall rep (r :: TYPE rep ) k v.
711+ #else
712+ forall r k v.
713+ #endif
705714 Eq k
706715 => ((# # ) -> r) -- Absent continuation
707716 -> (v -> Int -> r) -- Present continuation
@@ -915,10 +924,11 @@ setAtPosition i k x ary = A.update ary i (L k x)
915924
916925
917926-- | In-place update version of insert
918- unsafeInsert :: (Eq k , Hashable k ) => k -> v -> HashMap k v -> HashMap k v
927+ unsafeInsert :: forall k v . (Eq k , Hashable k ) => k -> v -> HashMap k v -> HashMap k v
919928unsafeInsert k0 v0 m0 = runST (go h0 k0 v0 0 m0)
920929 where
921930 h0 = hash k0
931+ go :: forall s . Hash -> k -> v -> Int -> HashMap k v -> ST s (HashMap k v )
922932 go ! h ! k x ! _ Empty = return $! Leaf h (L k x)
923933 go h k x s t@ (Leaf hy l@ (L ky y))
924934 | hy == h = if ky == k
@@ -2588,7 +2598,11 @@ fromListWithKey f = List.foldl' (\ m (k, v) -> unsafeInsertWithKey (\k' a b -> (
25882598-- | \(O(n)\) Look up the value associated with the given key in an
25892599-- array.
25902600lookupInArrayCont ::
2601+ #if defined(__GLASGOW_HASKELL__)
25912602 forall rep (r :: TYPE rep ) k v.
2603+ #else
2604+ forall r k v.
2605+ #endif
25922606 Eq k => ((# # ) -> r) -> (v -> Int -> r) -> k -> A. Array (Leaf k v) -> r
25932607lookupInArrayCont absent present k0 ary0 = go k0 ary0 0 (A. length ary0)
25942608 where
@@ -2841,9 +2855,11 @@ otherOfOneOrZero :: Int -> Int
28412855otherOfOneOrZero i = 1 - i
28422856{-# INLINE otherOfOneOrZero #-}
28432857
2858+ #if defined(__GLASGOW_HASKELL__)
28442859------------------------------------------------------------------------
28452860-- IsList instance
28462861instance (Eq k , Hashable k ) => Exts. IsList (HashMap k v ) where
28472862 type Item (HashMap k v ) = (k , v )
28482863 fromList = fromList
28492864 toList = toList
2865+ #endif
0 commit comments