[GHC] #14245: Make ScopedTypedVariables be effective for any type signature

GHC ghc-devs at haskell.org
Sun Sep 17 22:36:22 UTC 2017


#14245: Make ScopedTypedVariables be effective for any type signature
-------------------------------------+-------------------------------------
           Reporter:  jeltsch        |             Owner:  (none)
               Type:  feature        |            Status:  new
  request                            |
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.2.1
  (Type checker)                     |
           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:
-------------------------------------+-------------------------------------
 At the moment, `ScopedTypeVariables` does not have an effect for type
 signatures without an explicit `forall`. Therefore, you are forced to
 explicitly quantify type variables if you want the type variables of your
 type signature to be visible outside the type signature.

 When defining global variables, this means that you have to change part of
 the interface (the type signature) because of a change in the
 implementation. Of course, the change is only syntactical, but there is
 still a change. This is particularly problematic, because Haddock will
 follow the source code when deciding whether to include a top-level
 `forall` in the generated documentation or not. Your Haddock-generated
 documentation will include spurious `forall`s just because of the way your
 implementation works.

 You could say that this is just a Haddock issue. However, problems do not
 stop here. There is also an inconsistency between scoped type variables in
 variable definitions and scoped type variables in instance declarations.
 In instance declarations, you do not have to use an explicit `forall`.
 Type variables in the instance declaration head are visible in the body as
 soon as `ScopedTypeVariables` is enabled.

 I propose to change the semantics of `ScopedTypeVariables` such that as
 soon as it is enabled, the feature is in effect for all rank-1 type
 variables in any type signature.

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14245>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list