[GHC] #14896: QuantifiedConstraints: GHC does doesn't discharge constraints if they are quantified

GHC ghc-devs at haskell.org
Thu Mar 22 17:50:33 UTC 2018


#14896: QuantifiedConstraints: GHC does doesn't discharge constraints if they are
quantified
-------------------------------------+-------------------------------------
        Reporter:  Iceland_jack      |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.5
      Resolution:                    |             Keywords:
                                     |  QuantifiedConstraints, wipT2893
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by simonpj):

 Interesting.

 When inferring a type, GHC finds all the unsolved constraints. Supopse
 they are `(Eq a, Ord a)`.  Then it minimises them in a very simple-minded
 way, dicarding any that are implied by the superclasses of some other
 constraint.  So, since `Eq a` is a superclass of `Ord a`, we discard it.
 So we infer a type like
 {{{
 f :: Ord a => blah
 }}}
 Now suppose we have `(Bifunctor bi, Functor (bi a))`.  Yes, the latter is
 implied by the former, but now it is much more indirect.

 I'm not yet sure how to do a better job here.

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


More information about the ghc-tickets mailing list