#1310: confusing error message when trying to give a type-signature to an
imported
symbol
---------------------------+------------------------------------------------
Reporter: Isaac Dupree | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 6.6.1
Severity: normal | Keywords:
Difficulty: Unknown | Os: Unknown
Testcase: | Architecture: Unknown
---------------------------+------------------------------------------------
{{{
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'
}}}
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1310>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs