AST Annotations [Abandoned]
AbandonedPublic

Authored by alanz on Sep 26 2014, 8:55 AM.

Details

Reviewers
simonpj
austin
Trac Issues
#9628
Summary

Note: This diff has been abandoned in favour of D297.

Replacing Located with GenLocated, with a type parameter

The heart of the change is in SrcLoc which introduces

class (Outputable l, OutputableBndr l) => ApiAnnotation l where
    annGetSpan :: l -> SrcSpan
    annSetSpan :: l -> SrcSpan -> l
    annNoSpan  :: l

annNoLoc :: (ApiAnnotation l) => e -> GenLocated l e
annNoLoc e = L annNoSpan e

annGetLoc :: (ApiAnnotation l) => GenLocated l e -> SrcSpan
annGetLoc (L l _) = annGetSpan l

annSetLoc :: (ApiAnnotation l) => GenLocated l e -> SrcSpan -> GenLocated l e
annSetLoc (L l e) ss = L (annSetSpan l ss) e

annFromSpan :: (ApiAnnotation l) => SrcSpan -> l
annFromSpan s = annSetSpan annNoSpan s

instance ApiAnnotation SrcSpan where
  annGetSpan l = l
  annSetSpan _ ss = ss
  annNoSpan = noSrcSpan

instance OutputableBndr SrcSpan where
  pprPrefixOcc = ppr
  pprInfixOcc = ppr

The rest is working this through as a type parameter through all of hsSyn and repercussions.

Test Plan
sh ./validate

Diff Detail

Repository
rGHC Glasgow Haskell Compiler
Branch
wip/ast-ann-location
Lint
Lint ErrorsExcuse: preexisting
SeverityLocationCodeMessage
Errorcompiler/deSugar/DsArrows.lhs:25TXT2Tab Literal
Errorcompiler/deSugar/DsBinds.lhs:27TXT2Tab Literal
Errorcompiler/deSugar/DsUtils.lhs:22TXT2Tab Literal
Errorcompiler/deSugar/MatchCon.lhs:22TXT2Tab Literal
Warningcompiler/basicTypes/SrcLoc.lhs:190TXT3Line Too Long
Warningcompiler/basicTypes/SrcLoc.lhs:200TXT3Line Too Long
Warningcompiler/deSugar/Check.lhs:211TXT3Line Too Long
Warningcompiler/deSugar/Check.lhs:619TXT3Line Too Long
Warningcompiler/deSugar/Coverage.lhs:123TXT3Line Too Long
Warningcompiler/deSugar/Coverage.lhs:417TXT3Line Too Long
Warningcompiler/deSugar/Coverage.lhs:654TXT3Line Too Long
Warningcompiler/deSugar/Desugar.lhs:199TXT3Line Too Long
Warningcompiler/deSugar/Desugar.lhs:405TXT3Line Too Long
Warningcompiler/deSugar/DsArrows.lhs:547TXT3Line Too Long
Warningcompiler/deSugar/DsArrows.lhs:548TXT3Line Too Long
Warningcompiler/deSugar/DsArrows.lhs:1094TXT3Line Too Long
Warningcompiler/deSugar/DsArrows.lhs:1105TXT3Line Too Long
Warningcompiler/deSugar/DsExpr.lhs:554TXT3Line Too Long
Warningcompiler/deSugar/DsExpr.lhs:802TXT3Line Too Long
Warningcompiler/deSugar/DsGRHSs.lhs:60TXT3Line Too Long
Warningcompiler/deSugar/DsListComp.lhs:85TXT3Line Too Long
Warningcompiler/deSugar/DsMonad.lhs:215TXT3Line Too Long
Warningcompiler/deSugar/DsMonad.lhs:234TXT3Line Too Long
Warningcompiler/deSugar/DsMonad.lhs:371TXT3Line Too Long
Warningcompiler/deSugar/DsUtils.lhs:268TXT3Line Too Long
Unit
No Unit Test Coverage
Build Status
Buildable 1023
Build 1028: GHC Patch Validation (amd64/Linux)
alanz updated this revision to Diff 648.Sep 26 2014, 8:55 AM
alanz retitled this revision from to WIP, for comment.
alanz updated this object.
alanz edited the test plan for this revision. (Show Details)
alanz retitled this revision from WIP, for comment to AST Annotations.Sep 26 2014, 8:59 AM
alanz added a reviewer: simonpj.
alanz updated the Trac tickets for this revision.
alanz updated this object.Sep 26 2014, 9:02 AM
alanz updated this object.
alanz updated this object.Sep 26 2014, 9:04 AM
alanz updated this revision to Diff 684.Sep 29 2014, 3:33 PM
alanz updated this object.
  • WIP. deSugar compiles.
  • WIP. This is endless.
  • WIP. Ended up at the pipeline/Monad.
alanz abandoned this revision.Sep 30 2014, 11:00 AM

Too intrusive.

I learned a lot about how GHC hangs together inside, at least.

alanz retitled this revision from AST Annotations to AST Annotations [Abandoned].Oct 9 2014, 10:38 AM
alanz updated this object.
alanz updated this object.