Proposal: Adding on
duncan.coutts at worc.ox.ac.uk
Fri Nov 3 08:42:27 EST 2006
On Fri, 2006-11-03 at 13:23 +0100, Nils Anders Danielsson wrote:
> On Thu, 02 Nov 2006, Duncan Coutts <duncan.coutts at worc.ox.ac.uk> wrote:
> > I wonder about how this relates to 'comparing' which we already have in
> > Data.Ord. Does adding 'on' mean we should remove 'comparing' ?
> > I would suggest we keep both and add 'equating' to Data.Eq too, for
> > symmetry with 'comparing'.
> I think it's just as easy to understand (compare `on` f) as (comparing
> f), so having both just adds extra complexity. Hence I place comparing
> _under_ the Fairbairn threshold.
groupBy ((==) `on` fst)
vs groupBy (equating fst)
well, I disagree. Yes it's a special case, but I would use it in the
common special case and use `on` in the rarer general case.
But no matter.
So do you suggest that we deprecate and remove comparing?
Or do you think we should have comparing but not equating, leaving it
asymmetric and just claim that comparing was added too soon but couldn't
be removed? If the latter then perhaps you want to add a comment to the
comparing docs: Don't use @comparing foo@, use @compare `on` foo at .
More information about the Libraries