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

#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

#14245: Make ScopedTypedVariables be effective for any type signature -------------------------------------+------------------------------------- Reporter: jeltsch | Owner: (none) Type: feature request | Status: closed Priority: normal | Milestone: Component: Compiler (Type | Version: 8.2.1 checker) | Resolution: invalid | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by goldfire): * status: new => closed * resolution: => invalid Comment: I think this is a fine idea. It has a drawback in that it's not compatible with Haskell98 code, but perhaps that is not a deal-breaker. In any case, this kind of suggestion is perfect for the [https://github.com/ghc- proposals/ghc-proposals ghc-proposals] process, which I have found very valuable in understanding new ideas proposed for GHC (both as a proposer and as a reviewer of proposals). Feel free to copy and paste much of the text you have above, and don't worry so much about the fact that the proposal requires a "specification" -- your change is very simple to specify. In the meantime, I will close this ticket, as the community has settled on the ghc-proposals process as the official way to suggest user-facing changes to GHC. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14245#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14245: Make ScopedTypedVariables be effective for any type signature -------------------------------------+------------------------------------- Reporter: jeltsch | Owner: (none) Type: feature request | Status: closed Priority: normal | Milestone: Component: Compiler (Type | Version: 8.2.1 checker) | Resolution: invalid | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonpj): I'd also be OK with this if that's what everyone wants. I originally implemented the current semantics precisely to avoid accidentally breaking H98 programs, even when the extension is enabled, but the community may agree with you that I was too conservative! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14245#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14245: Make ScopedTypedVariables be effective for any type signature -------------------------------------+------------------------------------- Reporter: jeltsch | Owner: (none) Type: feature request | Status: closed Priority: normal | Milestone: Component: Compiler (Type | Version: 8.2.1 checker) | Resolution: invalid | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #12540 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by Iceland_jack): * related: => #12540 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14245#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14245: Make ScopedTypedVariables be effective for any type signature -------------------------------------+------------------------------------- Reporter: jeltsch | Owner: (none) Type: feature request | Status: closed Priority: normal | Milestone: Component: Compiler (Type | Version: 8.2.1 checker) | Resolution: invalid | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #12540 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by jeltsch): Note that the way `ScopedTypeVariables` works for instance declarations nowadays already breaks HaskellĀ 98/2010 code. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14245#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC