[GHC] #10194: Shouldn't this require ImpredicativeTypes?

GHC ghc-devs at haskell.org
Thu Mar 26 20:19:05 UTC 2015


#10194: Shouldn't this require ImpredicativeTypes?
-------------------------------------+-------------------------------------
              Reporter:  kosmikus    |             Owner:
                  Type:  bug         |            Status:  new
              Priority:  normal      |         Milestone:
             Component:  Compiler    |           Version:  7.8.4
  (Type checker)                     |  Operating System:  Unknown/Multiple
              Keywords:              |   Type of failure:  GHC accepts
          Architecture:              |  invalid program
  Unknown/Multiple                   |        Blocked By:
             Test Case:              |   Related Tickets:
              Blocking:              |
Differential Revisions:              |
-------------------------------------+-------------------------------------
 The following program compiles:

 {{{
 {-# LANGUAGE RankNTypes #-}
 module TestRN1 where

 type X = forall a . a

 comp :: (X -> c) -> (a -> X) -> (a -> c)
 comp = (.)
 }}}

 But this one fails:

 {{{
 {-# LANGUAGE RankNTypes #-}
 module TestRN2 where

 comp :: ((forall a . a) -> c) -> (a -> (forall a . a)) -> (a -> c)
 comp = (.)
 }}}

 Error:

 {{{
     Cannot instantiate unification variable ‘b0’
     with a type involving foralls: forall a1. a1
       Perhaps you want ImpredicativeTypes
     In the expression: (.)
     In an equation for ‘comp’: comp = (.)
 }}}

 I would expect both to fail. Both seem to rely on impredicative types. I
 wouldn't expect expansion of a type synonym to make a difference between a
 type-checking program and one that does not typecheck.

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


More information about the ghc-tickets mailing list