[GHC] #7140: Allow type signature in export list
GHC
cvs-ghc at haskell.org
Mon Aug 13 17:54:28 CEST 2012
#7140: Allow type signature in export list
------------------------------+---------------------------------------------
Reporter: drb226 | Owner:
Type: feature request | Status: new
Priority: normal | Component: Compiler (Type checker)
Version: | Keywords: module export type signature
Os: Unknown/Multiple | Architecture: Unknown/Multiple
Failure: None/Unknown | Testcase:
Blockedby: | Blocking:
Related: 2526 1404 |
------------------------------+---------------------------------------------
In response to the new InstanceSigs extension in the 7.6.1 RC1, waterlight
on Reddit suggested the following:
"While we're at it, why not also allow type signatures in export lists?
People tend to add them anyway as comments, just because it's useful
documentation. Checking for consistency would be nice."
The desired syntax, therefore, is something like this:
{{{
{-# LANGUAGE ExportSigs #-}
module Foo
( foo :: Bar -> Baz
, Blah ( Blip :: a -> Blah a
, Bloop :: Blah Int )
, Quux ( quux :: Quux q => a -> q a
, qux :: Quux q => q (q ()) )
) where
...
}}}
where all of the type annotations here are optional, and can be '''no less
restrictive''' than the corresponding type signatures provided at the
definition site, if provided (whether that be in that file's own code, or
imported from another file).
This would have non-trivial interaction with -fno-warn-missing-signatures,
and consequently, with [http://hackage.haskell.org/trac/ghc/ticket/2526
ticket #2526].
There may also be non-trivial interaction with GADTs, if we allow exported
constructors to be annotated with a type signature.
This idea was vaguely referenced by
[http://hackage.haskell.org/trac/ghc/ticket/1404 ticket #1404], to which
igloo responded:
"Type sigs in export lists might be nice, as some people seem to like
giving them as comments which then get out of sync with the actual types."
If we are to consider this sort of thing for Haskell', we should try it
out as a GHC extension first.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7140>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list