Implement recursive superclasses
AbandonedPublic

Authored by bgamari on Dec 9 2015, 1:00 PM.

Details

Reviewers
goldfire
austin
Trac Issues
#11067
#10318
#10592
Summary

This relatively-small patch implements a feature I previously thought
would be very hard: recursive superclasses. For motivation see

Dimitrios and I worked out that there is actually a relatively simple way
to do the job. It’s described in some detail in

Note [The superclass story]

in TcCanonical, and in

Note [Expanding superclasses]

in TcType.

I propose to put this in 8.0 unless we discover a significant problem.

Test Plan

Validate with included tests

Diff Detail

Repository
rGHC Glasgow Haskell Compiler
Lint
Lint WarningsExcuse: it's okay
SeverityLocationCodeMessage
Warningcompiler/typecheck/TcSimplify.hs:976TXT3Line Too Long
Warningcompiler/typecheck/TcSimplify.hs:1031TXT3Line Too Long
Warningcompiler/typecheck/TcSimplify.hs:1045TXT3Line Too Long
Warningcompiler/typecheck/TcSimplify.hs:1096TXT3Line Too Long
Warningcompiler/typecheck/TcSimplify.hs:1106TXT3Line Too Long
Warningcompiler/typecheck/TcTyDecls.hs:200TXT3Line Too Long
Warningcompiler/typecheck/TcTyDecls.hs:220TXT3Line Too Long
Warningcompiler/typecheck/TcTyDecls.hs:230TXT3Line Too Long
Warningcompiler/typecheck/TcTyDecls.hs:233TXT3Line Too Long
Warningtestsuite/tests/driver/T4437.hs:37TXT3Line Too Long
Warningtestsuite/tests/driver/T4437.hs:38TXT3Line Too Long
Warningtestsuite/tests/typecheck/should_compile/tc256.hs:1TXT3Line Too Long
Unit
No Unit Test Coverage
Build Status
Buildable 7288
Build 8784: GHC Patch Validation (amd64/Linux)
Build 8783: arc lint + arc unit
bgamari updated this revision to Diff 5586.Dec 9 2015, 1:00 PM
bgamari retitled this revision from to Implement recursive superclasses.
bgamari updated this object.
bgamari edited the test plan for this revision. (Show Details)
bgamari updated the Trac tickets for this revision.
bgamari added a subscriber: goldfire.
goldfire edited edge metadata.Dec 9 2015, 1:02 PM

May I politely request that we merge this after D808? Each patch like this throws me off by a day or more... picture a lumbering elephant trying to jump onto a moving train. :) I'm still aiming to merge D808 today, so it shouldn't be a long wait.

bgamari added a subscriber: simonpj.Dec 9 2015, 1:10 PM

May I politely request that we merge this after D808? Each patch like this throws me off by a day or more... picture a lumbering elephant trying to jump onto a moving train. :) I'm still aiming to merge D808 today, so it shouldn't be a long wait.

@simonpj, any objection to this? It does seem prudent to get D808 in earlier rather than later.

I'm happy to wait for D808

oerjan added a subscriber: oerjan.Dec 14 2015, 8:11 PM

I suspect type variables as heads cannot be so easily dismissed. Consider

class f (C f) => C f
class c => Id c
instance C Id
In D1594#48116, @oerjan wrote:

I suspect type variables as heads cannot be so easily dismissed. Consider

class f (C f) => C f
class c => Id c
instance C Id

Very good thank you!

bgamari abandoned this revision.Dec 16 2015, 11:24 AM

This has been merged.