[GHC] #14288: ScopedTypeVariables with nested foralls broken since 8.0.2

GHC ghc-devs at haskell.org
Mon Oct 2 13:37:27 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):

 OK. I tried out a similar example in Idris to see how it handles an
 example like `f4` from comment:14, and it turns out that Idris rejects it
 as well. So I'm now convinced that we shouldn't attempt to support
 examples like that.

 In light of this, what if we changed `foralls` from comment:7 to just
 this?

 * `foralls(forall a_1 ... a_k. T) = {a_1, ..., a_k} ∪ foralls (T)`
 * `foralls(C => T) = foralls(T)`

 That is, simply remove the `foralls(b -> c) = foralls(c)` case. This means
 that of these examples from comment:5:

 {{{#!hs
 f1 :: forall a. forall b. blah
 f2 :: forall a. a -> forall b. blah
 f3 :: forall a. Eq a => forall b. blah
 }}}

 Then in `f1` and `f3`, `a` and `b` will be lexically scoped, but in `f2`,
 only `a` will be lexically scoped. Does that sound agreeable?

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


More information about the ghc-tickets mailing list