[Haskell-cafe] MonoidHashMap?

Adam Bergmark adam at bergmark.nl
Tue Jan 20 12:52:21 UTC 2015


+1


On Tue, Jan 20, 2015 at 1:45 PM, Michael Snoyman <michael at snoyman.com>
wrote:

> I've definitely wanted it in the past, and have even implemented limited
> versions of it before. I'd be open to adding it to Data.Containers in
> mono-traversable[1].
>
> [1]
> http://www.stackage.org/haddock/nightly-2015-01-20/mono-traversable-0.7.0/Data-Containers.html
>
> On Tue Jan 20 2015 at 4:34:00 AM Konstantine Rybnikov <k-bx at k-bx.com>
> wrote:
>
>> Hi!
>>
>> I'm working with a lot of HashMap's and it's very frustrating how many
>> times I've "lost" my data because of usage of either a Monoid instance of a
>> HashMap (which is defined as H.union, which, upon collision, takes value
>> from first hm and discards from second), or just using fromList in the
>> wrong place. Whereas the data I'm working is is mostly defined as (Monoid v
>> => HashMap k v), so what I need "by default" is actually something like
>> `H.unionWith (<>)`.
>>
>> What I was wondering is this: is something like MonoidHashMap is desired
>> to be in unordered-containers, or is this use-case only popular in my
>> programs? I'm asking because I have a feeling that this thing might be
>> useful quite a lot for others also. If not -- sorry for bothering :)
>>
>> Cheers!
>> _______________________________________________
>> Haskell-Cafe mailing list
>> Haskell-Cafe at haskell.org
>> http://www.haskell.org/mailman/listinfo/haskell-cafe
>>
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20150120/f8bdc917/attachment.html>


More information about the Haskell-Cafe mailing list