[GHC] #12923: MultiParamTypeClasses + ExtendedDefaultRules

GHC ghc-devs at haskell.org
Tue Feb 14 15:59:12 UTC 2017


#12923: MultiParamTypeClasses + ExtendedDefaultRules
-------------------------------------+-------------------------------------
        Reporter:  amindfv           |                Owner:  (none)
            Type:  feature request   |               Status:  closed
        Priority:  normal            |            Milestone:  8.2.1
       Component:  Compiler          |              Version:  8.0.1
      Resolution:  fixed             |             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:                    |
-------------------------------------+-------------------------------------
Changes (by bgamari):

 * status:  patch => closed
 * resolution:   => fixed


Comment:

 Merged in,
 {{{
 commit c3bbd1afc85cd634d8d26e27bafb92cc7481667b
 Author: vivid-synth <vivid.haskell at gmail.com>
 Date:   Tue Feb 14 09:51:54 2017 -0500

     Allow type defaulting for multi-param type classes with
 ExtendedDefaultRules

     Expressions like the following will now typecheck:

     ```
         data A x = A deriving Show

         class ToA a x where
            toA :: a -> A x

         instance ToA Integer x where
            toA _ = A

         main = print (toA 5 :: A Bool)
     ```

     The new defaulting rules are

     Find all the unsolved constraints. Then:

     * Find those that have exactly one free type variable, and partition
       that subset into groups that share a common type variable `a`.
     * Now default `a` (to one of the types in the default list) if at
 least
       one of the classes `Ci` is an interactive class

     Reviewers: goldfire, bgamari, austin, mpickering, simonpj

     Reviewed By: bgamari, simonpj

     Subscribers: mpickering, simonpj, goldfire, thomie

     Differential Revision: https://phabricator.haskell.org/D2822
 }}}

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


More information about the ghc-tickets mailing list