darcs patch: add Data.Set.notMember and Data.Map.notMember
haskell at list.mightyreason.com
Sat Mar 11 07:28:30 EST 2006
Christian Maeder wrote:
> John Meacham wrote:
>> On Thu, Mar 09, 2006 at 11:09:50PM +0100, Jean-Philippe Bernardy wrote:
>>> Any evidence to add to the case ?
>> * symmetry with elem/notElem
> I don't like notElem either
>> * quite useful for cleaning up guards:
>> f x | not (x `Set.member` map) && foo = ...
>> is hard to read.
> You may swap quards (or the "then" and "else" branches of "if"), or
> avoid the infix notation (which is horrible in this case anyway).
> I don't think we need negated versions of any boolean function, that's
> what "not" is for!
Having notElem is needed for those of us who have a different opinion of using
infix notation (which is big part of Haskell's syntactic sugar compared to
Scheme). Adding to a library is a matter of balance: is there name clear or
ambiguous? is it being added because it is wanted or speculatively? In this case
there seems to be one clear meaning to the name "notElem" and there are users
who actually want it. So "notElem" and "notMember" are both good things to put
in the library.
More information about the Libraries