in Haskell, binaryfunction (f x) (g y)
can be rewritten f x `binaryfunction` g y
, removing a layer of parentheses, because function application has precedence higher than any operator.
permitting arbitrary binary functions to be turned into infix operators helps avoid Lisp's Too Many Parentheses. previously, praising the dollar-sign operator.
however, I don't use this backticks feature very frequently, because if the operands are more complicated than simple function application, then infix notation does not decrease parenthesization. for example: binaryoperator (f $ g x) (p $ q y) == (f $ g x) `binaryoperator` (p $ q y)
previously on binary operators, and currying them.
No comments :
Post a Comment