Skip to content

Commit 52cab04

Browse files
committed
Fix 'Eq2 HashMap' instance
Add missing 'instance Typeable HashMap' Remove usage of (<$>)
1 parent 7fad271 commit 52cab04

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

Data/HashMap/Base.hs

+2-1
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ type role HashMapInner nominal representational
167167
-- | A wrapper over 'HashMapInner'. The 'Int' field represent the hashmap's
168168
-- size.
169169
data HashMap k v = HashMap {-# UNPACK #-} !Int !(HashMapInner k v)
170+
deriving Typeable
170171

171172
instance (NFData k, NFData v) => NFData (HashMapInner k v) where
172173
rnf Empty = ()
@@ -254,7 +255,7 @@ instance Traversable (HashMap k) where
254255
traverse f = traverseWithKey (const f)
255256

256257
#if MIN_VERSION_base(4,9,0)
257-
instance Eq2 HashMapInner where
258+
instance Eq2 HashMap where
258259
liftEq2 = equal
259260

260261
instance Eq k => Eq1 (HashMap k) where

Data/HashMap/Strict.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ unsafeInsertWithInternal f k0 v0 m0 = runST (go h0 k0 v0 0 m0)
218218
else do
219219
let l' = x `seq` (L k x)
220220
return $! (1, collision h l l')
221-
| otherwise = (1,) <$> (x `seq` two s h k x hy ky y)
221+
| otherwise = (x `seq` two s h k x hy ky y) >>= return . (1,)
222222
go h k x s t@(BitmapIndexed b ary)
223223
| b .&. m == 0 = do
224224
ary' <- A.insertM ary i $! leaf h k x

0 commit comments

Comments
 (0)