[GHC] #12923: MultiParamTypeClasses + ExtendedDefaultRules

GHC ghc-devs at haskell.org
Wed Feb 8 12:04:12 UTC 2017


#12923: MultiParamTypeClasses + ExtendedDefaultRules
-------------------------------------+-------------------------------------
        Reporter:  amindfv           |                Owner:
            Type:  feature request   |               Status:  patch
        Priority:  normal            |            Milestone:  8.2.1
       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):  Phab:D2822
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by simonpj):

 You have realised that the spec in comment:12 can be further simplified
 (without changing its meaning):

  Find all the unsolved constraints. Then:

 * Find those that are of form `(C a)` where `a` is a type variable, and
 partition those constraints into groups that share a common type variable
 `a`.

 * Keep only the groups in which at least one of the classes is an
 interactive class.

 * Now, for each remaining group G, try each type `ty` from the default-
 type list in turn; if setting `a = ty` would allow the constraints in G to
 be completely solved.  If so, default `a` to `ty`.

 Note that any multi-parameter constraints `(D a b)` or `(D [a] Int)` do
 not participate in the process (either to help or to hinder); but they
 must of course be soluble once the defaulting process is complete.

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


More information about the ghc-tickets mailing list