[Haskell-cafe] ANN: signed-multiset-0.1
stefan at vectorfabrics.com
Mon Apr 23 15:18:04 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.
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.
> empty' = insert () $ delete () empty
> empty' <> delete () empty == empty'
> 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.)
*Data.SignedMultiset> let empty' = insert () $ delete () empty
*Data.SignedMultiset> empty' `union` delete () empty == empty'
*Data.SignedMultiset> empty `union` delete () empty == delete () empty
More information about the Haskell-Cafe