sebastian-philipp / StringMap

Haskell Project to convert the PrefixTree of the Holumbus into it's own Hackage Packet
MIT License
1 stars 5 forks source link

merge union and unionWith #4

Open sebastian-philipp opened 10 years ago

sebastian-philipp commented 10 years ago

What about:

union :: Monoid a => StringMap a -> StringMap a -> StringMap a

the current union uses const as the combination function. Instead, we should use Monoid a, because Monoid is in my opintion a perfect match for this problem.

UweSchmidt commented 10 years ago

A reason against this is, we then don't have the same interface as Data.Map.

A switch from

import qualified Data.Map as M
...
type MyMap v = M.Map String v

to

import qualified Data.StringMap as M
...
type MyMap v = M.StringMap v

should always be possible without changing anything else.

sebastian-philipp commented 10 years ago

https://github.com/haskell/containers/issues/43