Flipped function application

Wvv vitea3v
Wed Oct 9 18:51:39 UTC 2013


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.




More information about the Libraries mailing list