Proposal: Add (&) to Data.Function

Andreas Abel andreas.abel at ifi.lmu.de
Tue Nov 20 19:58:24 CET 2012


On 20.11.2012 19:46, John Wiegley wrote:
>>>>>> Edward Kmett <ekmett at gmail.com> writes:
>
>> We had switched to % from (|>) to be consistent with the other (+=) (*=)
>> operators where (%=) was being read as 'mod-equals' as a bit of a pun, and
>> could be seen as the application of the % operator to the target.
>
> Yes, a strong positive in favor of & of |> is that it allows the lens library
> to offer the highly useful variants &= and &~, which have obvious (and
> related) meanings

Well, the obvious meaning of &= is bitwise-and-with, like in

   x &= 0xff7f;

isn't it? ;-)

> to someone using lens.  |>= and |>~ would get a bit awkward
> in comparison.

The symbol |> combines the pipe | with an arrow > indicating the 
direction of information flow.  And it is used in ML already.  Hard to 
beat.


-- 
Andreas Abel  <><      Du bist der geliebte Mensch.

Theoretical Computer Science, University of Munich
Oettingenstr. 67, D-80538 Munich, GERMANY

andreas.abel at ifi.lmu.de
http://www2.tcs.ifi.lmu.de/~abel/



More information about the Libraries mailing list