Skip to content

Recusive superclass epansion is over-keen

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!

Trac metadata
Trac field Value
Version 8.2.2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information