Sjoerd, >>> Then why would you want that? >> >> You don't have to. (SignedMultiset a, additiveUnion, empty) gives you the >> Monoid that you seem to have a preference for. The library supplies it >> through the Additive wrapper. The point is that you have a choice: different >> applications may ask for different monoidal structures. > > Agreed. But I just can't imagine that the other instance is in any way > useful. You basically define a function max': > > max' :: Int -> Int -> Int > max' 0 b = b > max' a 0 = a > max' a b = max a b > > i.e. > > max' -2 -1 = -1 > max' -2 0 = -2 > max' -2 1 = 1 > > Wouldn't you agree that if you saw this defined in some code, you'd think > something is wrong?
If max' is supposed to implement the maximum of two nonzero values, I wouldn't be the slightest bit concerned. Seriously: if this is what people have agreed on to be a sensible semantics for hybrid sets, I am fine implementing it like this. >> *Data.SignedMultiset> let empty' = multiply 0 $ delete () empty >> >> *Data.SignedMultiset> empty' `union` delete () empty == empty' >> True >> >> *Data.SignedMultiset> empty `union` delete () empty == delete () empty >> True > > > And this doesn't bother you? Of course it does; it pinpoints a bug in multiply. It's fixed now: *Data.SignedMultiset> let empty' = multiply 0 $ delete () empty *Data.SignedMultiset> empty' `union` delete () empty == empty' False *Data.SignedMultiset> empty `union` delete () empty == delete () empty True Cheers, Stefan _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe