[GHC] #14860: QuantifiedConstraints: Can't quantify constraint involving type family

GHC ghc-devs at haskell.org
Tue Feb 27 16:25:35 UTC 2018


#14860: QuantifiedConstraints: Can't quantify constraint involving type family
-------------------------------------+-------------------------------------
        Reporter:  RyanGlScott       |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler (Type    |              Version:  8.5
  checker)                           |             Keywords:
      Resolution:                    |  QuantifiedConstraints wipT2893
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 simonpj):

 Remember, a quantified constraint is a bit like a local instance
 declaration.  We don't allow
 {{{
 instance C (F a) where ...
 }}}
 where `F` is a type function; and no more should we allow
 {{{
 forall a. Show (Apply f a)
 }}}
 as a quantified constraint (`Apply` is a type function).

 It's a bug that I do not reject it.

 This works
 {{{
 type family   Apply (f :: * -> *) :: * -> *
 type instance Apply Proxy = Proxy

 instance (t ~ Apply f, forall a. Show (t a)) => Show (ExTyFam f) where
 }}}
 It's tiresome to lift the family application out, but it forces you to
 ensure that the instance head is ok.

 Do you agree?

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


More information about the ghc-tickets mailing list