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.