#7140: Allow type signature in export list
---------------------------------------------+------------------------------
    Reporter:  drb226                        |       Owner:                  
        Type:  feature request               |      Status:  new             
    Priority:  normal                        |   Milestone:                  
   Component:  Compiler (Type checker)       |     Version:                  
    Keywords:  module export type signature  |          Os:  Unknown/Multiple
Architecture:  Unknown/Multiple              |     Failure:  None/Unknown    
  Difficulty:  Unknown                       |    Testcase:                  
   Blockedby:                                |    Blocking:                  
     Related:  2526 1404                     |  
---------------------------------------------+------------------------------
Changes (by igloo):

  * difficulty:  => Unknown


Old description:

> 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.

New description:

 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 #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 #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#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to