Skip to content

Bad error message "Invalid type signature"

The following line of code:

foreign export ccall foo :: IO ()

generates this error message:

TestErr.hs:1:0: Invalid type signature

(In this case, the programmer error was of course that the !ForeignFunctionInterface pragma is missing, and the parser has treated this as a definition of the function 'foreign'; this is a motivational example and not directly relevant to the issue)

This error message is quite uninformative - and after looking at the code which generates it, I still can't figure out what kind of error it's supposed to be detecting. It should be changed to explain why the type signature appears to be invalid. Ideally, it would then be immediately apparent that the line has been parsed in an unexpected way.

Trac metadata
Trac field Value
Version 6.12.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler (Parser)
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