Fixity of backtick operators?

主宰稳场 提交于 2019-12-23 06:48:14

问题


What is the fixity of backtick operators?

For instance in this code from Real World Haskell:

ghci> (1+) `fmap` [1,2,3] ++ [4,5,6]
[2,3,4,4,5,6]

It's evident the backtick operator `fmap` has a higher fixity than ++, but none is given by GHCi.


回答1:


§4.4.2 of the Haskell Report states that

Any operator lacking a fixity declaration is assumed to be infixl 9

"Any operator" includes normal function names in backticks.

Your example shows that `fmap` does have higher fixity than ++, because ++ acts on the result of the fmap.



来源:https://stackoverflow.com/questions/7807994/fixity-of-backtick-operators

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!