Flipped function application

Oren Ben-Kiki haskell-oren
Wed Oct 9 18:52:59 UTC 2013


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




More information about the Libraries mailing list