darcs patch: add Data.Set.notMember and Data.Map.notMember / generalized infix notation use case

Jean-Philippe Bernardy jeanphilippe.bernardy at gmail.com
Sat Mar 11 03:51:52 EST 2006

Patch applied. Still, In time, I suppose the somewhat ugly

not (element `member` set)

sould be addressed by a mixture of generalized infix notation and the
definition of such an operator:

f /. g = \x y -> f (g x y)


element `not/.member` set


On 3/11/06, Cale Gibbard <cgibbard at gmail.com> wrote:
> > 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).
> >
> Although I'd normally agree with negated versions of things being
> somewhat redundant, the infix version here is rather important, since
> one often wants the code to look the same way as the mathematics. The
> symbols \in and \not\in are both usually written infix, and that's not
> going to change soon. Putting the membership operation in between is
> nice, because we read the guard here as "If x is a member of xs
> then..." rather than "If member x xs then..." anyway. Perhaps if the
> proposal to allow somewhat more general expressions as infix operators
> goes through (which I'm actually ambivalent about), I'd feel different
> about this case.
> If you want to reduce redundancy, let's unify the 3 separate ways to
> say 'map'. :)
>  - Cale
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://www.haskell.org/mailman/listinfo/libraries

More information about the Libraries mailing list