[GHC] #15639: Surprising failure combining QuantifiedConstraints with Coercible

GHC ghc-devs at haskell.org
Thu Dec 6 08:29:48 UTC 2018


#15639: Surprising failure combining QuantifiedConstraints with Coercible
-------------------------------------+-------------------------------------
        Reporter:  dfeuer            |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:  8.6.1
       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:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by simonpj):

 >  So I don't think the current behavior matches the user's guide.

 That's probably true.  The built-in rules for `Coercible` apply first.  So
 we reduce `Coercible (Yeah a) (Yeah b)` to `Coercible a (Yeah b)` and
 thence to `Coercible a b`.  All this before we even start to consider
 instances.

 It's a bit like type-class overlap. GHC doesn't have backtracking, and
 just picks one path.  If you have overlap (as here, in this case between a
 quantified constraint and a built-in equality-decomposition rule) then GHC
 just picks one (in this case the built-in rule).

 The best thing is to avoid overlap.

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


More information about the ghc-tickets mailing list