Skip to content

Precedence errors are reported for undefined operators

I found a misleading error message.

If I add the import for (<$>), but I forget to save the file

-- other imports
-- import Control.Applicative ((<$>))
main = print $ (+1).(+2) <$> Just 5

I get the error

    precedence parsing error
        cannot mix `(.)' [infixr 9] and `(<$>)' [infixl 9] in the same infix expression

which is rather hard to debug, since it makes it seem that the problem is either with Control.Applicative's precedence definitions or that I've somehow imported (<$>) with a different precedence from somewhere else.

It would be nice if it would report instead that (<$>) wasn't defined yet.

Trac metadata
Trac field Value
Version 6.10.1
Type FeatureRequest
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information