[GHC] #14734: QuantifiedConstraints conflated with impredicative polymorphism?

GHC ghc-devs at haskell.org
Mon Jan 29 01:40:03 UTC 2018


#14734: QuantifiedConstraints conflated with impredicative polymorphism?
-------------------------------------+-------------------------------------
           Reporter:  Iceland_jack   |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.5
           Keywords:                 |  Operating System:  Unknown/Multiple
  QuantifiedConstraints              |
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 This works:

 {{{#!hs
 {-# Language QuantifiedConstraints #-}
 {-# Language GADTs #-}
 {-# Language ConstraintKinds #-}
 {-# Language KindSignatures #-}
 {-# Language RankNTypes #-}
 {-# Language FlexibleInstances #-}
 {-# Language UndecidableInstances #-}
 {-# Language TypeOperators #-}

 import Data.Kind

 data D c where
   D :: c => D c

 newtype a :- b = Sub (a => D b)

 class    (forall xx. f xx) => Limit f
 instance (forall xx. f xx) => Limit f

 proof :: Limit Eq :- Eq (Int -> Float)
 proof = Sub D
 }}}

 If we replace `Limit Eq` with `(forall xx. Eq xx)` it is considered
 impredicative polymorphism, but is it?

 {{{

 174-quantifiedconstraints.hs:20:10: error:
     • Illegal polymorphic type: forall xx. Eq xx
       GHC doesn't yet support impredicative polymorphism
     • In the type signature:
         proof :: (forall xx. Eq xx) :- Eq (Int -> Float)
    |
 20 | proof :: (forall xx. Eq xx) :- Eq (Int -> Float)
    |          ^^^^^^^^^^^^^^^^^
 }}}

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


More information about the ghc-tickets mailing list