Skip to content

Add type family rewriting functionality to typechecking plugins

sheaf requested to merge sheaf/ghc:tcplugins into master

This MR adds built-in functionality for typechecker plugins to rewrite type family applications, by inserting calls to the plugins in Tc.Solver.Rewrite.rewrite_exact_fam_app.

This also includes a small refactoring of the GHC type-checking plugin API, as it doesn't make sense to pass an EvBindsVar to rewriter plugins. So I changed the TcPluginM newtype to remove the EvBindsVar, instead passing it manually to constraint solver plugins.

This is all accompanied by additional information in extending_ghc, both about constraint solving and type-family rewriting in type-checking plugins.

Two tests are added: one testing the functionality, and one testing the performance impact (which is minimal to non-existent).

Edited by sheaf

Merge request reports