Sjoerd Visscher sjoerd at w3future.com
Mon Apr 23 14:42:23 CEST 2012

```This is not just about map, but it also a problem for the Monoid instance. You are basically adding an extra identity element, 0, to the max monoid, which works but is weird. You'll have to call norm everywhere to make it work, f.e. you would expect this to work:

empty' = insert () \$ delete () empty

but:

empty' <> delete () empty == empty'

while:

empty <> delete () empty == delete () empty

(I couldn't test it as I don't have base 4.5, so I hope I didn't make a mistake here.)

greetings,
Sjoerd

On Apr 23, 2012, at 2:07 PM, Stefan Holdermans wrote:

> Sjoerd,
>
>>>>> For a specific example, I haven't the faintest intuition about
>>>>> what 'map' should do.  Suppose we have
>>>>> 	{(k1)x1, (k2)x2}
>>>>> and f x1 == f x2 = y.  Should the value of map f {...} be
>>>>> {(k1+k2)y} or {(k1`max`k2)y} or what?
>
>> I don't think max would be a good choice, as that would mean that the default multiplicity would have to be negative infinity (the identity element of max) instead of 0, and then using Int as the type for multiplicity would not cut it.
>
> Why would one need such an identity element for map?
>
> Note that the monoidal structure isn't defined over the "maximum of multiplicites" but over the "maximum of *nonzero* multiplicites". (For ordinary sets and ordinary multisets these operations happen to coincide.)
>
> Cheers,
>
>  Stefan
>

```