[GHC] #16140: Cannot create type synonym for quantified constraint without ImpredicativeTypes

GHC ghc-devs at haskell.org
Tue Jan 8 15:45:57 UTC 2019


#16140: Cannot create type synonym for quantified constraint without
ImpredicativeTypes
-------------------------------------+-------------------------------------
        Reporter:  Ashley Yakeley    |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.6.3
      Resolution:                    |             Keywords:
                                     |  QuantifiedConstraints,
                                     |  ImpredicativeTypes
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 tried your suggestion in comment:3, and unfortunately, impredicativity
 //does// sneak in, as the following is accepted:

 {{{#!hs
 {-# LANGUAGE KindSignatures, RankNTypes, ConstraintKinds,
 QuantifiedConstraints, FlexibleInstances, UndecidableInstances #-}
 {-# LANGUAGE FlexibleContexts #-}
 {-# LANGUAGE GADTs #-}
 {-# LANGUAGE ImplicitParams #-}
 module Bug where

 import Data.Kind
 import Data.Proxy

 type F1 (f :: * -> *) = forall a. Eq (f a)
 class (Functor f, F1 f) => C f
 instance (Functor f, F1 f) => C f
 type F2 f = (Functor f, F1 f)

 f :: (Proxy (F2 f) ~ Proxy (F2 f)) => Int
 f = 42
 }}}

 On the other hand, the following variant:

 {{{#!hs
 g :: (Proxy (Functor f, forall a. Eq (f a)) ~ Proxy (Functor f, forall a.
 Eq (f a))) => Int
 g = 42
 }}}

 Is rejected as impredicative. (It's possible that this is just #16059
 manifesting in a different way, though.)

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


More information about the ghc-tickets mailing list