# Proposal: Add (&) to Data.Function

Gábor Lehel illissius at gmail.com
Tue Nov 20 21:59:07 CET 2012

```On Tue, Nov 20, 2012 at 9:27 PM, Edward Kmett <ekmett at gmail.com> wrote:
> Note: (>>>) is a completely different operator.
>
>>>> is flipped (.). The proposed & is flipped \$.
>
> (>>>)  :: Category cat => cat a b -> cat b c -> cat a c
>
> (&) :: a -> (a -> b) -> b
>
> -Edward

...and my quibble with (&) as flip (\$) is that I think it would, in
fact, be more mnemonic as a synonym for (>>>).

Consider:

filter even & map (*2) & sum

That reads naturally and obviously as "filter by even and double and
sum". It's an operation. What if we apply it to an argument?

(filter even & map (*2) & sum) theList

Still works. Filter by even and double and sum the list.

What if (&) is flip (\$) instead?

theList & filter even & map (*2) & sum

The second two are fine enough (same as before), but the first one is
weird. What does it mean to "the list and filter by even"? It feels
like a type error.

>
> On Tue, Nov 20, 2012 at 3:14 PM, Henning Thielemann
> <lemming at henning-thielemann.de> wrote:
>>
>>
>> On Tue, 20 Nov 2012, Yitzchak Gale wrote:
>>
>>>  It is a common idiom to write a sequence of composed combinators in
>>>  reverse order to the way they would be written with (\$) or (.). That
>>>  naturally expresses the idea of the combinators as operations being
>>>  applied in the given order.
>>>
>>>  This comes up so often, and is commonly used so many times in a single
>>>  expression, that Control.Arrow.>>> is far too wordy, and even a two-
>>>  character operator is awkward.
>>
>>
>> Functional metapost called it (#). But for me (>>>) is ok. It is even more
>> descriptive than (&).
>>
>> _______________________________________________
>> Libraries mailing list
>>
>
>
> _______________________________________________
> Libraries mailing list