[GHC] #14288: ScopedTypeVariables with nested foralls broken since 8.0.2
GHC
ghc-devs at haskell.org
Fri Sep 29 15:52:59 UTC 2017
#14288: ScopedTypeVariables with nested foralls broken since 8.0.2
-------------------------------------+-------------------------------------
Reporter: MikolajKonarski | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler (Type | Version: 8.2.1
checker) |
Resolution: | Keywords:
Operating System: Linux | Architecture: x86_64
Type of failure: GHC rejects | (amd64)
valid program | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by RyanGlScott):
As far as specifying how GHC should bring variables from nested `forall`s
into scope, I don't think it's nearly as difficult as you're making it out
to be. The algorithm would be as follows: when `ScopedTypeVariables` is
enabled and an identifier with an explicit type signature `T` is being
typechecked, then the set of variables `foralls(T)` is brought into scope,
where:
* `foralls(forall a_1 ... a_k. T) = {a_1, ..., a_k} ∪ foralls (T)`
* `foralls(C => T) = foralls(T)`
* `foralls(b -> c) = foralls(c)`
Note that this doesn't expand type synonyms, so we needn't worry about
your `Foo` example in comment:5 bringing variables into scope.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14288#comment:7>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list