#4189: Add (<.>) operator (generalizing (.) to Functor)

Dan Doel dan.doel at gmail.com
Mon Aug 2 13:27:17 EDT 2010

On Monday 02 August 2010 12:30:01 pm Stephen Tetley wrote:
> For sure, we don't conceptualize them as 3 parameter functions because
> they're more general. But Maciej Piechotka's (<.>) is just a function
> so not its as general as the arrow operators.

So what? 99% of the uses I've ever seen of (&&&), (|||), etc. are with the 
Arrow instance for (->). I'd, at least, consider them worth adding even 
specialized to that instance if they didn't already exist in their more 
general forms. And I'd still think of the specialized versions as binary, 
because using combinators that accept and return functions is one of the perks 
of using a functional language.

> My point was that in Prelude + subset of Base, infix symbol names are
> used for binary functions, not arbitrary combinators like `on` (vis
> the three exceptions listed). Whether this is a worthwhile principle
> or even whether its just an accident and not a principle is open to
> debate. My opinion is that its worth airing it now, as granting a
> place in Base for (<.>) would feel like a precedent.

on is named on because uses like

  compare `on` fst

read nicely, and are suggestive of their meaning. And then there are div, 
elem, max, etc. which are frequently used infix, but are alphabetic binary 

I'm not sure how enthusiastic I am about (<.>). But this rule about naming 
(which as far as I know, has not informed any previous decisions; (<=<) and 
(>=>) are not very old; they were added in GHC 6.8/base 3) is not a good 
argument against it.

-- Dan

More information about the Libraries mailing list