I aplogise for the following long post on Api Annotations.
They are a new feature, and allow a whole class of tools to become much simpler. The interest in this technology can be seen in the strong support Matt Pickering's proposal for GSOC achieved, and that it was accepted. This project is a good showcase for the annotations, as it should allow the hints from HLint to be directly applied to the source code.
This technology can only be useful when it is generally available, which means being baked in to the compiler. We came really close to getting it all together for 7.10.1, but unfortunately some issues slipped through. These were picked up when Matt Pickering ran the ghc-exactrpint utliity over most of hackage, and found the remaining ones. The fixes for these are now all queued up in trac/phab with patches. If they do not go in to 7.10.2 it means waiting for 7.12 to be in general use before the tooling built from this can be used widely.
The patches themselves do not change the operation of the compiler, merely re-arrange things slightly in the parsing stage, to make sure all the annotations make it through to the final ParsedSource. The two most intrusive ones are
D840, which introduces new parser productions to correct a pre-existing error where `'[]` was parsed as a `HsTyVar` rather than a `HsExplicitListTy`. These have different annotations so it is a problem; and
D836, which preserves the parsed `HsForAllTy` structure, including any nested `HsParTy` wrappers. This results in the original flattening code being moved out of `RdrHsSyn` into the renamer and typechecker, but does not change any of the operations.
I know this places a huge burden on Austin in particular, because it requires a lot of merge operations from the number of patches. The only way I can propose to ease this is to submit a mega-patch with all the changes, which can be applied at once, once the individual ones are reviewed and found acceptable (with whatever fixes are required).
The full list of Trac tickers / Phab patches follows below.
Regards
Alan
---------------------------------------------------------
10207 - parser: ParStmt has incorrect SrcSpan
D803 (landed 7.10.2)
10214 - parser: TransStmt has incorrect SrcSpan
D806 (landed 7.10.2)
---
10209 - parser: opt_kind_sig has incorrect SrcSpan
D813 (landed master, scheduled 7.10.2)
10255 - API Annotations : ExprWithTySig processing discards annotated spans
D823 (landed master, scheduled 7.10.2)
---
10357 - ApiAnnotations : pquals production adds AnnVbar in the wrong place
D869
10358 - ApiAnnotations : PatBind gives wrong SrcSpan for the pattern.
D873
10254 - parser : the API annotation on opt_sig is being discarded
D822 (landed master)
10256 - parser: API Annotations : guardquals1 does not annotate commas properly
D818 (landed master)
10268 - ApiAnnotations : quoted type variables missing leading quote
D825. (Accepted Austin) Depends D840/#10299
10269 - ApiAnnotations : RdrHsSyn.isFunLhs discards parentheses
D832 (Accepted Austin)
Note: Potentially keep HsPar as an alternate?
10277 - ApiAnnotations : lexer discards comment close in nested comment
D829 (landed master)
10280 - ApiAnnotations : AnnComma missing in TupleSection
D834 (Accepted Austin)
10287 - ApiAnnotations : BooleanFormula construction discards original
D837. Partial fix. Full fix by locating BooleanFormula properly.
10307 - Api Annotations: RdrHsSyn.mkAtDefault causes annotations to be disconnected
D842
10309 - ApiAnnotations : mkGadtDecl discards annotations for HsFunTy
D848
10312 - ApiAnnotations: misplaced AnnComma for squals production
D846 (accepted Austin)
10299 - D840: Correct parsing of lifted empty list constructor
D840
--- The next four are all addressed by D836
10315 - ApiAnnotations : Empty context loses annotations
D855 retired, fixed by 10354/D836
10354 - ApiAnnotations : parens around a context with wildcard loses annotations
D868 - no, superseded by D836
10363 - ApiAnnotations : HsForAllTy discards parens
D836
10278 - ApiAnnotations : Nested forall loses forall annotation
D836 (old/alternate D833)
---------------------------------------------------------