Skip to content
This repository was archived by the owner on Oct 4, 2020. It is now read-only.

Commit 80f185b

Browse files
committed
Merge pull request #28 from MichaelXavier/monoid-strmap
Add Monoid instance for StrMap
2 parents 465226d + 7231fb9 commit 80f185b

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,13 @@ instance semigroupStrMap :: (P.Semigroup a) => P.Semigroup (StrMap a)
430430
```
431431

432432

433+
#### `monoidStrMap`
434+
435+
``` purescript
436+
instance monoidStrMap :: (P.Semigroup a) => Monoid (StrMap a)
437+
```
438+
439+
433440

434441
## Module Data.StrMap.ST
435442

src/Data/StrMap.purs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,3 +293,6 @@ map = P.(<$>)
293293

294294
instance semigroupStrMap :: (P.Semigroup a) => P.Semigroup (StrMap a) where
295295
(<>) m1 m2 = mutate (\s -> foldM (\s k v2 -> SM.poke s k (runFn4 _lookup v2 (\v1 -> v1 P.<> v2) k m2)) s m1) m2
296+
297+
instance monoidStrMap :: (P.Semigroup a) => Monoid (StrMap a) where
298+
mempty = empty

0 commit comments

Comments
 (0)