Map with a Semigroup and Monoid instances delegating to Semigroup of the elements
|LTS Haskell 20.23:||0.1.5|
|Stackage Nightly 2023-05-28:||0.1.5|
|Latest on Hackage:||0.1.5|
Maintained by email@example.com
This version can be pinned in stack with:
Module documentation for 0.1.5
Data.Map wrapper with a
Monoid instances that delegate to
the individual keys.
import qualified Data.Map as Map import Data.Map.Append > one = AppendMap $ Map.fromList [(1, "hello"), (2, "goodbye")] > two = AppendMap $ Map.fromList [(1, "world"), (3, "again")] > unAppendMap (one <> two) fromList [(1, "helloworld"), (2, "goodbye"), (3, "again")]
Data.Map has a
Semigroup instance that keeps the values from the first
argument in case of a key conflict:
import qualified Data.Map as Map import Data.Map.Append > Map.fromList [(1, "hello")] <> Map.fromList [(1, "goodbye")] fromList [(1, "hello")]
A different instance has been suggested for a long time (1, 2), but this is a breaking change and hasn’t happened yet (as of 2018-08).
Source code is formatted with
./bumpversion patch|minor|major. This will create a new version and push it to the repository to be released.
Changelog for appendmap
- Fix tests on older LTS
- Wrappers for lazy and strict versions of
- Initial release on Hackage.