[GHC] #14774: Recusive superclass epansion is over-keen

GHC ghc-devs at haskell.org
Wed Feb 7 11:40:38 UTC 2018


#14774: Recusive superclass epansion is over-keen
-------------------------------------+-------------------------------------
           Reporter:  simonpj        |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.2.2
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 Consider this, with `RecursiveSuperClasses`:
 {{{
 class C a => D a where
   cop :: a -> a

 class D a => C a where
   dop :: a -> a

 g :: C a => a -> Bool
 g x = g x

 f :: C a => a -> Bool
 f x = g x
 }}}
 When we compile this we get
 {{{
 f = \ (@ a_aXf) ($dC_aXh :: C a_aXf) (eta_B1 :: a_aXf) ->
       g @ a_aXf (Foo.$p1D @ a_aXf (Foo.$p1C @ a_aXf $dC_aXh)) eta_B1
 }}}
 Notice the ridiculous double superclass selection from `$dC_aXh`. It's not
 wrong, just stupid!

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


More information about the ghc-tickets mailing list