@@ -181,6 +181,10 @@ import qualified Data.List as List
181181import qualified GHC.Exts as Exts
182182import qualified Language.Haskell.TH.Syntax as TH
183183
184+ #if defined(__MHS__)
185+ import Data.Traversable
186+ #endif
187+
184188-- | Convenience function. Compute a hash value for the given value.
185189hash :: H. Hashable a => a -> Hash
186190hash = fromIntegral . H. hash
@@ -191,9 +195,11 @@ data Leaf k v = L !k v
191195instance (NFData k , NFData v ) => NFData (Leaf k v ) where
192196 rnf (L k v) = rnf k `seq` rnf v
193197
198+ #if !defined(__MHS__)
194199-- | @since 0.2.17.0
195200instance (TH. Lift k , TH. Lift v ) => TH. Lift (Leaf k v ) where
196201 liftTyped (L k v) = [|| L k $! v || ]
202+ #endif
197203
198204-- | @since 0.2.14.0
199205instance NFData k => NFData1 (Leaf k ) where
@@ -700,7 +706,11 @@ lookupRecordCollision# h k m =
700706-- this whole thing is always inlined, we don't have to worry about
701707-- any extra CPS overhead.
702708lookupCont ::
709+ #if !defined(__MHS__)
703710 forall rep (r :: TYPE rep ) k v.
711+ #else
712+ forall r k v.
713+ #endif
704714 Eq k
705715 => ((# # ) -> r) -- Absent continuation
706716 -> (v -> Int -> r) -- Present continuation
@@ -914,10 +924,11 @@ setAtPosition i k x ary = A.update ary i (L k x)
914924
915925
916926-- | In-place update version of insert
917- 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
918928unsafeInsert k0 v0 m0 = runST (go h0 k0 v0 0 m0)
919929 where
920930 h0 = hash k0
931+ go :: forall s . Hash -> k -> v -> Int -> HashMap k v -> ST s (HashMap k v )
921932 go ! h ! k x ! _ Empty = return $! Leaf h (L k x)
922933 go h k x s t@ (Leaf hy l@ (L ky y))
923934 | hy == h = if ky == k
@@ -2413,7 +2424,11 @@ fromListWithKey f = List.foldl' (\ m (k, v) -> unsafeInsertWithKey (\k' a b -> (
24132424-- | \(O(n)\) Look up the value associated with the given key in an
24142425-- array.
24152426lookupInArrayCont ::
2427+ #if !defined(__MHS__)
24162428 forall rep (r :: TYPE rep ) k v.
2429+ #else
2430+ forall r k v.
2431+ #endif
24172432 Eq k => ((# # ) -> r) -> (v -> Int -> r) -> k -> A. Array (Leaf k v) -> r
24182433lookupInArrayCont absent present k0 ary0 = go k0 ary0 0 (A. length ary0)
24192434 where
@@ -2666,9 +2681,11 @@ otherOfOneOrZero :: Int -> Int
26662681otherOfOneOrZero i = 1 - i
26672682{-# INLINE otherOfOneOrZero #-}
26682683
2684+ #if !defined(__MHS__)
26692685------------------------------------------------------------------------
26702686-- IsList instance
26712687instance (Eq k , Hashable k ) => Exts. IsList (HashMap k v ) where
26722688 type Item (HashMap k v ) = (k , v )
26732689 fromList = fromList
26742690 toList = toList
2691+ #endif
0 commit comments