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

GHC ghc-devs at haskell.org
Fri Jan 25 23:56:18 UTC 2019


#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
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  GHC rejects       |  Unknown/Multiple
  valid program                      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #16123            |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by RyanGlScott):

 Yes, I think I was a bit too bold in declaring comment:23 to be a viable
 workaround (in fact, I'm now discovering places in the aforementioned
 large codebase where this technique breaks down).

 A much uglier (but likelier to work in the long run) hack is to add
 another parameter to `C`:

 {{{#!hs
 class (forall b. (ta ~ T a, Show b) => Show (ta b)) => C a ta where
   type family T a :: * -> *

 data D a = MkD (T a Int)
 deriving instance (ta ~ T a, C a ta) => Show (D a)
 }}}

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


More information about the ghc-tickets mailing list