-Wmissing-signatures uses forall even when invalid in source
The -Wmissing-signatures warning is great to learn about the signatures that things should have, and is especially useful when teaching Haskell to beginners.
Unfortunately, it uses explicit quantification (forall) even when in the compiled module, this is not valid:
$ echo 'foo x = x' > Foo.hs
$ ghci -Wall Foo.hs
GHCi, version 8.0.1: http://www.haskell.org/ghc/ :? for help
[1 of 1] Compiling Main ( Foo.hs, interpreted )
Foo.hs:1:1: warning: [-Wmissing-signatures]
Top-level binding with no type signature: foo :: forall t. t -> t
Ok, modules loaded: Main.
*Main>
$ echo -e 'foo :: forall t. t -> t\nfoo x = x' > Foo.hs
$ ghci -Wall Foo.hs
GHCi, version 8.0.1: http://www.haskell.org/ghc/ :? for help
[1 of 1] Compiling Main ( Foo.hs, interpreted )
Foo.hs:1:16: error:
Illegal symbol '.' in type
Perhaps you intended to use RankNTypes or a similar language
extension to enable explicit-forall syntax: forall <tvs>. <type>
Failed, modules loaded: none.
The type signature provided by -Wmissing-signatures should be in a form that is valid in the context of the function that is missing the signature.
Trac metadata
| Trac field | Value |
|---|---|
| Version | 8.0.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |