Add a -fprint-axiom-incomps option (#15546)
AbandonedPublic

Authored by mniip on Aug 23 2018, 2:35 PM.

Details

Reviewers
simonpj
bgamari
goldfire
Trac Issues
#15546
Summary

Supply branch incomps when building an IfaceClosedSynFamilyTyCon

pprTyThing now has access to incomps. This also causes them to be
written out to .hi files, but that doesn't pose an issue other than a
more faithful bijection between tyThingToIfaceDecl and tcIfaceDecl.

The machinery for displaying axiom incomps was already present but not
in use. Since this is now a thing that pops up in ghci's :info the
format was modified to look like a haskell comment.

Documentation and a test for the new feature included.

Test Plan

T15546

mniip created this revision.Aug 23 2018, 2:35 PM

Yes, that looks fine.

Now there is only one call to the rather bogus coAxBranchToIfaceBranch' function, so you can inline it. The bogusness is setting the incomps to [], and that won't happen once it's inlined.

I also stumbled on this:

data IfaceFamTyConFlav
  = IfaceDataFamilyTyCon                      -- Data family
  | IfaceOpenSynFamilyTyCon
  | IfaceClosedSynFamilyTyCon (Maybe (IfExtName, [IfaceAxBranch]))
    -- ^ Name of associated axiom and branches for pretty printing purposes,
    -- or 'Nothing' for an empty closed family without an axiom
...

That "for pretty printing purposes" is significant. The [IfaceAxBranch] is totally ignored when deserialising an interface file in TcIface. It is only used in the pretty-printing code which converts TyCons etc to IfaceSyn form before pretty printing. We should refer to the Note that explain why we do this -- but where is that Note?? I think it's there but I can't find it.

mniip added a comment.Aug 23 2018, 5:51 PM

The relevant commit seems to be rGHCb4856f9f4f0fb3db473901b247d3fa94a11c25a0 but I don't see any relevant Notes being introduced in that.

mniip updated this revision to Diff 17775.Aug 23 2018, 7:03 PM
  • Inline coAxBranchToIfaceBranch'

I don't see any relevant Notes being introduced in that.

OK. I'll push a patch adding such a Note, shortly. Then you can rebase.

mniip updated this revision to Diff 18234.Oct 5 2018, 7:30 AM

Added a Note regarding -fprint-axiom-incoms and a reference in the user guide

mniip added a comment.Oct 16 2018, 4:42 PM

@simonpj Added all changes requested via Trac. Any further comments?

simonpj accepted this revision.Oct 25 2018, 10:38 AM

Yes, go for it.

This revision is now accepted and ready to land.Oct 25 2018, 10:38 AM
bgamari abandoned this revision.Jan 20 2019, 8:08 PM

Moved to GitLab for CI.