Flipped function application

Dan Burton danburton.email
Wed Oct 9 19:23:06 UTC 2013


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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/libraries/attachments/20131009/2632c468/attachment-0001.html>




More information about the Libraries mailing list