[GHC] #15079: GHC HEAD regression: cannot instantiate higher-rank kind

GHC ghc-devs at haskell.org
Thu May 3 14:31:36 UTC 2018


#15079: GHC HEAD regression: cannot instantiate higher-rank kind
-------------------------------------+-------------------------------------
        Reporter:  RyanGlScott       |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  high              |            Milestone:  8.6.1
       Component:  Compiler (Type    |              Version:  8.5
  checker)                           |
      Resolution:                    |             Keywords:  TypeInType
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  GHC rejects       |  Unknown/Multiple
  valid program                      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by RyanGlScott):

 I too find it rather bizarre that the visibilities of each type variable
 binder have to line up when instantiating a higher-rank kind, since that
 isn't a requirement for higher-rank types:

 {{{#!hs
 {-# LANGUAGE RankNTypes #-}
 module Bug where

 id' x = x

 f :: (forall a. a -> a) -> b -> c -> (b, c)
 f g b c = (g b, g c)

 h :: b -> c -> (b, c)
 h = f id'
 }}}

 `h` typechecks, despite the fact that the type of `id'` is `forall {p}. p
 -> p` (i.e., with an inferred variable), and `f` is supposed to take an
 argument of type `forall a. a -> a` (i.e., with a specified variable).

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


More information about the ghc-tickets mailing list