[GHC] #9420: Impredicative type instantiation without -XImpredicativeTypes

GHC ghc-devs at haskell.org
Sat Nov 11 22:20:29 UTC 2017


#9420: Impredicative type instantiation without -XImpredicativeTypes
-------------------------------------+-------------------------------------
        Reporter:  goldfire          |                Owner:  (none)
            Type:  bug               |               Status:  closed
        Priority:  normal            |            Milestone:
       Component:  Compiler (Type    |              Version:  7.9
  checker)                           |             Keywords:
      Resolution:  fixed             |  ImpredicativeTypes
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #11319            |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by RyanGlScott):

 * status:  new => closed
 * resolution:   => fixed
 * related:   => #11319


Comment:

 This has been fixed since GHC 8.0.1, since GHC now does properly detect
 the impredicative instantiation:

 {{{
 GHCi, version 8.2.1: http://www.haskell.org/ghc/  :? for help
 Loaded GHCi configuration from /home/rgscott/.ghci
 [1 of 1] Compiling Bug              ( Bug2.hs, interpreted )

 Bug2.hs:14:13: error:
     • Cannot instantiate unification variable ‘a0’
       with a type involving foralls: (forall a. a -> a) -> b0
         GHC doesn't yet support impredicative polymorphism
     • In the second argument of ‘(.)’, namely ‘rank2’
       In the expression: foo . rank2
       In the expression: foo . rank2 $ quux
    |
 14 | bar = foo . rank2 $ quux
    |             ^^^^^

 Bug2.hs:14:21: error:
     • Cannot instantiate unification variable ‘a0’
       with a type involving foralls: (forall a. a -> a) -> Int
         GHC doesn't yet support impredicative polymorphism
     • In the second argument of ‘($)’, namely ‘quux’
       In the expression: foo . rank2 $ quux
       In an equation for ‘bar’: bar = foo . rank2 $ quux
    |
 14 | bar = foo . rank2 $ quux
    |                     ^^^^
 }}}

 (See also #11319 for the plan to allow such impredicative instantiations
 via `TypeApplications`.)

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


More information about the ghc-tickets mailing list