Flipped function application

John Lato jwlato
Thu Oct 10 17:14:13 UTC 2013


On Oct 10, 2013 3:47 AM, "Simon Peyton-Jones" <simonpj at microsoft.com> wrote:
>
> I believe my previous participation in that discussion was to promote
(|>), but at this point I don't really care what it's called, I just think
that this operator under any symbolic name should be present in an easily
accessible location, preferably in base libs.
>
>
>
> I agree with the sentiment!  The OO folk uses this style all the time!
 (thing .op1 .op2) meaning op2 (op1 thing).
>

I don't understand this reasoning. Why should Haskell have strongly
baked-in support for OO style? And take up a rare 1- or 2-char op name?
Especially since it can be provided by a library?

But then, I still have a suspicion that Edward is a massive troll trying to
embed Java in Haskell, so this might just be my bias.

>
>
> F# uses (|>).   Maybe (#) is good.    To me (&) looks too commutative
because it?s usually used for conjunction.
>
>
>
> Resolving this kind of no-perfect-solution-but-we-need-a-solution thing
is what the core libraries committee is for.  Let?s ask them if they?d
consider taking it on.
>
>
>
> Simon
>
>
>
> From: Libraries [mailto:libraries-bounces at haskell.org] On Behalf Of Dan
Burton
> Sent: 09 October 2013 20:23
> To: Edward Kmett
> Cc: libraries at haskell.org
> Subject: Re: Flipped function application
>
>
>
> What were the arguments against (&)? Were they about that choice of
symbol in particular, or about the presence of such an operator at all? If
the former, then we can keep putting different colors on the bikeshed until
we find one everyone likes. If the latter, then I guess we just stick with
telling people to import it from lens or diagrams or whatever.
>
>
>
> I believe my previous participation in that discussion was to promote
(|>), but at this point I don't really care what it's called, I just think
that this operator under any symbolic name should be present in an easily
accessible location, preferably in base libs.
>
>
>
>
> -- Dan Burton
>
>
>
> On Wed, Oct 9, 2013 at 12:00 PM, Edward Kmett <ekmett at gmail.com> wrote:
>>
>> Attempting to get (&) added to Data.Function led to a rather profound
amount of disagreement last time it was brought up, so eventually we just
let the status quo continue.
>>
>> -Edward
>>
>>
>> On Oct 9, 2013, at 2:52 PM, Oren Ben-Kiki <haskell-oren at ben-kiki.org>
wrote:
>>>
>>> & is already used for this purpose by the Lens library...
>>>
>>>
>>>
>>> On Wed, Oct 9, 2013 at 9:51 PM, Wvv <vitea3v at rambler.ru> wrote:
>>>>
>>>> It's looking very strange, that such easy function as flipped function
>>>> application is still absent at the base.
>>>>
>>>>
>>>> x # f = f x
>>>> infixl 1 #     -- infix (#) must conflict neither ($), nor (.)
>>>>
>>>> We could add it to Data.Functions and probably to Prelude.
>>>>
>>>> It is very useful function to get rid of parentheses (1); "object
looking"
>>>> record style (2); left-to-right function reading style (3); nice
looking
>>>> last argument-data (4)
>>>>
>>>> 1) xs # map $ someLong function
>>>>    x # some . function . composition
>>>> 2) car # color
>>>> 3) myString # lines # map words # concat # filter myFilter # unwords
>>>> 4) eitherData # either (left long function) (right long function)
>>>>
>>>>
>>>> Many of possible names are already busy. I made the review of possible
>>>> names:
>>>>
>>>>   #    - free; disadvantage: possible conflicts with Magic Hash
>>>>   ##  - free; disadvantage: heavy looking; possible conflicts with
Magic
>>>> Hash
>>>> `to`  - free; disadvantage: not easy to read composite functions
>>>>  <:    - free;
>>>>  &     - free; (conflict with fgl package) disadvantage: looking like
>>>> boolean operator
>>>>  .:     - free;
>>>>  .:.    - free; disadvantage: many dots
>>>>  <-|  - free; disadvantage: long name
>>>>  <+   - free;
>>>>  <~   - free;
>>>>  :~    - free;
>>>>  -|-   - free; disadvantage: bad looking;
>>>>  %    - busy: Data.Ratio
>>>>  %%  - free; disadvantage: heavy looking;
>>>>   ^    - busy: Prelude
>>>>  .^.   - free;
>>>>  ^^^ - free; disadvantage: long name
>>>>  |.|    - free; disadvantage: strange looking;
>>>>   *$    - free; disadvantage: looking like ($)
>>>>  <|    - busy: Data.Sequence
>>>>  <     - busy: Prelude
>>>>  <<   - busy: Text.Html; Text.XHtml.* from html and xhtml package
>>>>  <<< - busy: Control.Category
>>>>  *     - busy: Prelude
>>>>  **   - busy: Prelude
>>>>  ***  - busy: Control.Arrow
>>>>  <*>  - busy: Control.Applicative
>>>>  <**> - busy: Control.Applicative
>>>>   !!    - busy: Prelude
>>>>   -|   - busy: Control.Parallel.Strategies
>>>>  your suggestion  - free;
>>>>
>>>> I prefer (#) , then (.:) and then (<:).
>>>>
>>>> What do you prefer?
>>>>
>>>> Possible looking (copy to your editor to taste them):
>>>>
>>>> 2.1 # max 50 # cos # tan # negate # ceiling
>>>>
>>>> 2.1 ## max 50 ## cos ## tan ## negate ## ceiling
>>>>
>>>> 2.1 `to` max 50 `to` cos `to` tan `to` negate `to` ceiling
>>>>
>>>> 2.1 <: max 50 <: cos <: tan <: negate <: ceiling
>>>>
>>>> 2.1 & max 50 & cos & tan & negate & ceiling
>>>>
>>>> 2.1 .: max 50 .: cos .: tan .: negate .: ceiling
>>>>
>>>> 2.1 .:. max 50 .:. cos .:. tan .: negate .:. ceiling
>>>>
>>>> 2.1 <-| max 50 <-| cos <-| tan <-| negate <-| ceiling
>>>>
>>>> 2.1 <+ max 50 <+ cos <+ tan <+ negate <+ ceiling
>>>>
>>>> 2.1 <~ max 50 <~ cos <~ tan <~ negate <~ ceiling
>>>>
>>>> 2.1 % max 50 % cos % tan % negate % ceiling
>>>>
>>>> 2.1 %% max 50 %% cos %% tan %% negate %% ceiling
>>>>
>>>> 2.1 .^. max 50 .^. cos .^. tan .^. negate .^. ceiling
>>>>
>>>> 2.1 :~ max 50 :~ cos :~ tan :~ negate :~ ceiling
>>>>
>>>> 2.1 |.| max 50 |.| cos |.| tan |.| negate |.| ceiling
>>>>
>>>> 2.1 -|- max 50 -|- cos -|- tan -|- negate -|- ceiling
>>>>
>>>>
>>>>
>>>> --
>>>> View this message in context:
http://haskell.1045720.n5.nabble.com/Flipped-function-application-tp5738131.html
>>>> Sent from the Haskell - Libraries mailing list archive at Nabble.com.
>>>> _______________________________________________
>>>> Libraries mailing list
>>>> Libraries at haskell.org
>>>> http://www.haskell.org/mailman/listinfo/libraries
>>>
>>>
>>>
>>> _______________________________________________
>>> Libraries mailing list
>>> Libraries at haskell.org
>>> http://www.haskell.org/mailman/listinfo/libraries
>>
>>
>> _______________________________________________
>> Libraries mailing list
>> Libraries at haskell.org
>> http://www.haskell.org/mailman/listinfo/libraries
>
>
>
>
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://www.haskell.org/mailman/listinfo/libraries
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/libraries/attachments/20131010/633f23ef/attachment.html>




More information about the Libraries mailing list