@@ -76,10 +76,10 @@ pureST :: forall a. (forall h e. Eff (st :: ST.ST h | e) (SM.STStrMap h a)) -> S
76
76
pureST f = runPure (runST f)
77
77
78
78
mutate :: forall a b . (forall h e . SM.STStrMap h a -> Eff (st :: ST.ST h | e ) b ) -> StrMap a -> StrMap a
79
- mutate f m = pureST ( do
79
+ mutate f m = pureST do
80
80
s <- thawST m
81
- f s
82
- pure s)
81
+ _ <- f s
82
+ pure s
83
83
84
84
foreign import _fmapStrMap :: forall a b . Fn2 (StrMap a ) (a -> b ) (StrMap b )
85
85
@@ -149,10 +149,10 @@ foreign import size :: forall a. StrMap a -> Number
149
149
150
150
-- | Create a map with one key/value pair
151
151
singleton :: forall a . String -> a -> StrMap a
152
- singleton k v = pureST ( do
152
+ singleton k v = pureST do
153
153
s <- SM .new
154
- SM .poke s k v
155
- pure s)
154
+ _ <- SM .poke s k v
155
+ pure s
156
156
157
157
foreign import _lookup :: forall a z . Fn4 z (a -> z ) String (StrMap a ) z
158
158
@@ -166,13 +166,13 @@ member = runFn4 _lookup false (const true)
166
166
167
167
-- | Insert a key and value into a map
168
168
insert :: forall a . String -> a -> StrMap a -> StrMap a
169
- insert k v = mutate (\s -> SM .poke s k v)
169
+ insert k v = mutate (\s -> void $ SM .poke s k v)
170
170
171
171
foreign import _unsafeDeleteStrMap :: forall a . Fn2 (StrMap a ) String (StrMap a )
172
172
173
173
-- | Delete a key and value from a map
174
174
delete :: forall a . String -> StrMap a -> StrMap a
175
- delete k = mutate (\s -> SM .delete s k)
175
+ delete k = mutate (\s -> void $ SM .delete s k)
176
176
177
177
-- | Delete a key and value from a map, returning the value
178
178
-- | as well as the subsequent map
@@ -225,7 +225,7 @@ values = L.fromFoldable <<< _collect (\_ v -> v)
225
225
-- | Compute the union of two maps, preferring the first map in the case of
226
226
-- | duplicate keys.
227
227
union :: forall a . StrMap a -> StrMap a -> StrMap a
228
- union m = mutate (\s -> foldM SM .poke s m)
228
+ union m = mutate (\s -> void $ foldM SM .poke s m)
229
229
230
230
-- | Compute the union of a collection of maps
231
231
unions :: forall a . L.List (StrMap a ) -> StrMap a
@@ -238,7 +238,7 @@ mapWithKey :: forall a b. (String -> a -> b) -> StrMap a -> StrMap b
238
238
mapWithKey f m = runFn2 _mapWithKey m f
239
239
240
240
instance semigroupStrMap :: (Semigroup a ) => Semigroup (StrMap a ) where
241
- append m1 m2 = mutate (\s1 -> foldM (\s2 k v2 -> SM .poke s2 k (runFn4 _lookup v2 (\v1 -> v1 <> v2) k m2)) s1 m1) m2
241
+ append m1 m2 = mutate (\s1 -> void $ foldM (\s2 k v2 -> SM .poke s2 k (runFn4 _lookup v2 (\v1 -> v1 <> v2) k m2)) s1 m1) m2
242
242
243
243
instance monoidStrMap :: (Semigroup a ) => Monoid (StrMap a ) where
244
244
mempty = empty
0 commit comments