File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change 2
2
{-# LANGUAGE ScopedTypeVariables #-}
3
3
{-# LANGUAGE PatternGuards #-}
4
4
#if __GLASGOW_HASKELL__ >= 708
5
+ {-# LANGUAGE RoleAnnotations #-}
5
6
{-# LANGUAGE TypeFamilies #-}
6
7
#endif
7
8
{-# OPTIONS_GHC -fno-full-laziness -funbox-strict-fields #-}
@@ -145,6 +146,10 @@ data HashMap k v
145
146
| Collision ! Hash ! (A. Array (Leaf k v ))
146
147
deriving (Typeable )
147
148
149
+ #if __GLASGOW_HASKELL__ >= 708
150
+ type role HashMap nominal representational
151
+ #endif
152
+
148
153
instance (NFData k , NFData v ) => NFData (HashMap k v ) where
149
154
rnf Empty = ()
150
155
rnf (BitmapIndexed _ ary) = rnf ary
@@ -607,8 +612,8 @@ adjust f k0 m0 = go h0 k0 0 m0
607
612
| otherwise = t
608
613
{-# INLINABLE adjust #-}
609
614
610
- -- | /O(log n)/ The expression (@'update' f k map@) updates the value @x@ at @k@,
611
- -- (if it is in the map). If (f k x) is @'Nothing', the element is deleted.
615
+ -- | /O(log n)/ The expression (@'update' f k map@) updates the value @x@ at @k@,
616
+ -- (if it is in the map). If (f k x) is @'Nothing', the element is deleted.
612
617
-- If it is (@'Just' y), the key k is bound to the new value y.
613
618
update :: (Eq k , Hashable k ) => (a -> Maybe a ) -> k -> HashMap k a -> HashMap k a
614
619
update f = alter (>>= f)
Original file line number Diff line number Diff line change 1
1
{-# LANGUAGE CPP, DeriveDataTypeable #-}
2
2
#if __GLASGOW_HASKELL__ >= 708
3
+ {-# LANGUAGE RoleAnnotations #-}
3
4
{-# LANGUAGE TypeFamilies #-}
4
5
#endif
5
6
#if __GLASGOW_HASKELL__ >= 702
@@ -95,6 +96,10 @@ newtype HashSet a = HashSet {
95
96
asMap :: HashMap a ()
96
97
} deriving (Typeable )
97
98
99
+ #if __GLASGOW_HASKELL__ >= 708
100
+ type role HashSet nominal
101
+ #endif
102
+
98
103
instance (NFData a ) => NFData (HashSet a ) where
99
104
rnf = rnf . asMap
100
105
{-# INLINE rnf #-}
You can’t perform that action at this time.
0 commit comments