[GHC] #12923: MultiParamTypeClasses + ExtendedDefaultRules

GHC ghc-devs at haskell.org
Fri Dec 9 19:30:08 UTC 2016


#12923: MultiParamTypeClasses + ExtendedDefaultRules
-------------------------------------+-------------------------------------
        Reporter:  amindfv           |                Owner:
            Type:  feature request   |               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 amindfv):

 For my needs, given the rule linked above:

  "All of the classes Ci are single-parameter type classes."

 I would relax it to say:

  "Only one parameter in each class Ci has kind `:: *` "


 so this would be a valid program...

 {{{#!hs
 class Works a (b :: Bool) where
    works :: a -> A b
 instance Works Double 'True
 main = print (works 5 :: A 'True)
 }}}


 ...but this would remain ambiguous:

 {{{#!hs
 class Doesnt a b where
    doesnt :: a -> b
 instance Doesnt Double Bool
 main = print $ doesnt 5 True
 }}}


 The defaulting rule could be relaxed more, but this seems like the
 smallest possible change. Additionally, this change is critical for my
 EDSL's coherence; a more-relaxed rule would just be nice-to-have.

 Thank you!

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


More information about the ghc-tickets mailing list