Is there an inverse of the Haskell $ operator?

前端 未结 6 417
感情败类
感情败类 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:18

    This combinator is defined (tongue in cheek) in the data-aviary package:

    Prelude Data.Aviary.BirdsInter> 1 `thrush` (+2)
    Loading package data-aviary-0.2.3 ... linking ... done.
    3
    

    Although actually using that package is a rather silly thing to do, reading the source is fun, and reveals that this combinator is formed via the magic incantation of flip id (or, in ornithological parlance, cardinal idiot).

提交回复
热议问题