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

GHC ghc-devs at haskell.org
Mon Jan 21 21:39:43 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 simonpj):

 Hmm.  Well, please note that this quantified constraint will fire on a
 constraint like `Show (Maybe Int)` Why?  Because we can instantiate `Show
 (ta b)` to give `(Show (Maybe Int)`.  So the quantified constraint
 overlaps with the top-level instance; but quantified constraints are tried
 (currently) before top-level instances, so the quantified constraint will
 "win".   That might lead you to try to solve `(Maybe ~ T a)` which will
 probably fail.

 Perhaps in the applications you have in mind this will be fine.  And if
 so, that's great.  But I just wanted to point out that there might be
 unintended consequence.

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


More information about the ghc-tickets mailing list