[GHC] #12791: Superclass methods could be more aggressively specialised.

GHC ghc-devs at haskell.org
Wed Nov 9 23:12:01 UTC 2016


#12791: Superclass methods could be more aggressively specialised.
-------------------------------------+-------------------------------------
        Reporter:  mpickering        |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.0.1
      Resolution:                    |             Keywords:
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 dfeuer):

 Replying to [comment:5 simonpj]:

 > GHC's constraint solver uses the "given" constraint (here `Num Int` via
 a superclass of `C Int b`) where possible.  You may say "If there is an
 instance declaration, use that instead of the given constraint.  But no
 > {{{
 > f :: Ord [a] => ...
 > f x = ..Need Eq [a]...
 > }}}

 If we didn't have overlapping instances, could we reduce the `Ord [a]`
 constraint to `Ord a` when checking the signature (changing the semantics
 of `FlexibleContexts` a bit)? That would open up a different path to `Eq
 [a]`. Or do these constraints sometimes arise in situations where they
 can't be (or shouldn't be) reduced?

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


More information about the ghc-tickets mailing list