Do pretty-printing of TyThings via IfaceDecl (Trac #7730)
authorSimon Peyton Jones <simonpj@microsoft.com>
Tue, 3 Jun 2014 13:15:52 +0000 (14:15 +0100)
committerSimon Peyton Jones <simonpj@microsoft.com>
Tue, 3 Jun 2014 13:24:08 +0000 (14:24 +0100)
commitb4856f9f4f0fb3db473901b247d3fa94a11c25a0
tree64512fff57acca9baf54d0e72d516679763711a9
parentda64c97f1c0b147ea80a34fe64fe947ba7820c00
Do pretty-printing of TyThings via IfaceDecl (Trac #7730)

All the initial work on this was done fy 'archblob' (fcsernik@gmail.com);
thank you!

I reviewed the patch, started some tidying, up and then ended up in a huge
swamp of changes, not all of which I can remember now.  But:

* To suppress kind arguments when we have -fno-print-explicit-kinds,
    - IfaceTyConApp argument types are in a tagged list IfaceTcArgs

* To allow overloaded types to be printed with =>, add IfaceDFunTy to IfaceType.

* When printing data/type family instances for the user, I've made them
  print out an informative RHS, which is a new feature. Thus
        ghci> info T
        data family T a
        data instance T Int = T1 Int Int
        data instance T Bool = T2

* In implementation terms, pprIfaceDecl has just one "context" argument,
  of type IfaceSyn.ShowSub, which says
       - How to print the binders of the decl
         see note [Printing IfaceDecl binders] in IfaceSyn
       - Which sub-comoponents (eg constructors) to print

* Moved FastStringEnv from RnEnv to OccName

It all took a ridiculously long time to do.  But it's done!
35 files changed:
compiler/basicTypes/OccName.lhs
compiler/iface/IfaceSyn.lhs
compiler/iface/IfaceType.lhs
compiler/iface/LoadIface.lhs
compiler/iface/MkIface.lhs
compiler/iface/TcIface.lhs
compiler/main/GHC.hs
compiler/main/PprTyThing.hs
compiler/rename/RnEnv.lhs
compiler/typecheck/TcRnDriver.lhs
compiler/types/FamInstEnv.lhs
ghc/InteractiveUI.hs
testsuite/tests/ghci/scripts/T4087.stdout
testsuite/tests/ghci/scripts/T4175.stdout
testsuite/tests/ghci/scripts/T5417.stdout
testsuite/tests/ghci/scripts/T7873.stdout
testsuite/tests/ghci/scripts/T7939.stdout
testsuite/tests/ghci/scripts/T8674.stdout
testsuite/tests/ghci/scripts/all.T
testsuite/tests/ghci/scripts/ghci025.stdout
testsuite/tests/indexed-types/should_compile/T3017.stderr
testsuite/tests/indexed-types/should_fail/ClosedFam3.stderr
testsuite/tests/rename/should_fail/rnfail055.stderr
testsuite/tests/roles/should_compile/Roles1.stderr
testsuite/tests/roles/should_compile/Roles14.stderr
testsuite/tests/roles/should_compile/Roles2.stderr
testsuite/tests/roles/should_compile/Roles3.stderr
testsuite/tests/roles/should_compile/Roles4.stderr
testsuite/tests/roles/should_compile/T8958.stderr
testsuite/tests/roles/should_fail/Roles12.stderr
testsuite/tests/simplCore/should_compile/T4201.stdout
testsuite/tests/simplCore/should_compile/T4918.stdout
testsuite/tests/th/TH_Roles2.stderr
testsuite/tests/typecheck/should_compile/tc231.stderr
testsuite/tests/typecheck/should_fail/T3468.stderr