[Haskell-cafe] ANN: signed-multiset-0.1

Sjoerd Visscher sjoerd at w3future.com
Mon Apr 23 16:01:45 CEST 2012


On Apr 23, 2012, at 3:18 PM, Stefan Holdermans wrote:

> Sjoerd,
> 
>> 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.
> 
> Still that's how union is typically defined for hybrid sets. It's what happens if want union and empty to behave as generalisations of these concepts for ordinary (multi)sets.

Then why would you want that?

> *Data.SignedMultiset> let empty' = insert () $ delete () empty
> 
> *Data.SignedMultiset> empty' `union` delete () empty == empty'
> False
> 
> *Data.SignedMultiset> empty `union` delete () empty == delete () empty
> True


Ah, I missed the check in insertMany.

What about the same with

let empty' = multiply 0 $ delete () empty

greetings,
Sjoerd





More information about the Haskell-Cafe mailing list