confusing error message when trying to give a type-signature to an imported symbol
import Prelude(putStrLn,String,IO)
main = putStrLn "ha" --works fine; putStrLn _is_ in (this) scope
putStrLn :: String -> IO () --produces ghc error: Not in scope: `putStrLn'
Prelude.putStrLn :: String -> IO () --produces ghc error: Invalid type signature
I think an error message more like "type signatures can't be given to functions(or non-function data) not defined in the same module" in both cases would be clearer. Not sure what the right phrase is for "functions(or non-function data)", "symbols",?
main = putStrLn "ha"
where p :: String -> IO ()
p x = putStrLn x
--produces ghc error: Misplaced type signature: p :: String -> IO ()
which shows a little more understanding in that case... If someone didn't understand how that style of type-signature could only appear parallel to a definition, I'm not sure how helpful it is.
main = putStrLn "ha"
where putStrLn :: String -> IO ()
--produces ghc error for the second line: Not in scope: `putStrLn'
Trac metadata
Trac field | Value |
---|---|
Version | 6.6.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | Unknown |
Architecture | Unknown |