Is there an inverse of the Haskell $ operator?

前端 未结 6 431
感情败类
感情败类 2021-02-01 13:44

A quick question, is there an operator in Haskell that works like the dollar sign but gives precedence to the left hand side. I.E. instead of

f (x 1) 
         


        
6条回答
  •  南笙
    南笙 (楼主)
    2021-02-01 14:35

    In Haskell you can use flip to change arguments' order of any binary function or operator:

    ghci> let (|>) = flip ($)
    ghci> 3 |> (+4) |> (*6)
    42
    

提交回复
热议问题