Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fixity of backtick operators?

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.

like image 402
Matt Joiner Avatar asked Oct 18 '11 13:10

Matt Joiner


1 Answers

§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.

like image 78
dave4420 Avatar answered Oct 26 '22 00:10

dave4420