[GHC] #14939: Lint error in forall type (was: StaticPointers + -dcore-lint: cause Core Lint error??)

GHC ghc-devs at haskell.org
Thu May 31 22:01:35 UTC 2018


#14939: Lint error in forall type
-------------------------------------+-------------------------------------
        Reporter:  Iceland_jack      |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.5
      Resolution:                    |             Keywords:
                                     |  StaticPointers
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):

 The Lint error is this:
 {{{
     In the type `forall (cls :: * -> Constraint) (b :: Alg cls *). b'
     Variable escape in forall: forall (cls :: * -> Constraint)
                                       (b :: Alg cls *).
                                       b
 }}}
 The complaint is because the kind of the body of the forall is `Alg cls
 *`, but the forall binds `cls` so it looks as if `cls` escapes.  But
 actually it is fine because
 {{{
 type Alg cls ob = ob
 }}}
 so `Alg cls *` is really just `*`, and the `cls` argument is not mentioned
 in the expansion.

 I conclude that the program is fine and it's Lint that is at fault.

 c.f. `TcUnify.occCheckExpand` and `CoreUtils.coreAltsType` which deal with
 the same problem.  A single systematic solution eludes me.

 I worry that `Type.typeKind` suffers from the same problem, in the
 `ForAllTy` case.

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


More information about the ghc-tickets mailing list