[GHC] #12597: -Wmissing-signatures uses forall even when invalid in source
GHC
ghc-devs at haskell.org
Wed Sep 14 02:47:39 UTC 2016
#12597: -Wmissing-signatures uses forall even when invalid in source
-------------------------------------+-------------------------------------
Reporter: nomeata | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.0.1
Keywords: | Operating System: Unknown/Multiple
Architecture: | Type of failure: None/Unknown
Unknown/Multiple |
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
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.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12597>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list