Proposal: Remove Semigroup and Monoid instances for Data.Map, Data.IntMap, Data.HashMap

Akio Takano tkn.akio at gmail.com
Wed Feb 14 10:16:13 UTC 2018


Hi Oleg,

On 14 February 2018 at 09:48, Oleg Grenrus <oleg.grenrus at iki.fi> wrote:
> I agree with Oliver, was just writing the very same.
>
>
> `Map.map First = Map.map coerce = coerce`
>
> i.e. mapping First is _zero-cost_, thanks to the fact `v` in `Map k v`
> has represenational role.

Yes, I agree that mapping First is zero-cost. I'm saying that
`unionWith (<>)` over the First monoid costs more than `union`, due to
allocation of extra thunks.

- Akio


More information about the Libraries mailing list