Exact print annotations exist so that tools can perform source to source conversions of Haskell code. They are used to keep track of the various syntactic keywords that are not otherwise captured in the AST.
The wiki page describing this feature is https://gitlab.haskell.org/ghc/ghc/wikis/api-annotations https://gitlab.haskell.org/ghc/ghc/-/wikis/implementing-trees-that-grow/in-tree-api-annotations
Note: in general the names of these are taken from the corresponding token, unless otherwise noted See Note [exact print annotations] above for details of the usage
Constructors
AnnAnyclassAnnAsAnnBang!AnnBackquote'`'
AnnByAnnCasecase or lambda case
AnnCaseslambda cases
AnnClassAnnClose'#)' or '#-}' etc
AnnCloseB'|)'
AnnCloseBU'|)', unicode variant
AnnCloseC'}'
AnnCloseQ'|]'
AnnCloseQU'|]', unicode variant
AnnCloseP')'
AnnClosePH'#)'
AnnCloseS']'
AnnColonAnnCommaas a list separator
AnnCommaTuplein a RdrName for a tuple
AnnDarrow=>AnnDarrowU=>, unicode variantAnnDataAnnDcolon::AnnDcolonU::, unicode variantAnnDefaultAnnDerivingAnnDoAnnDotAnnDotdot..AnnElseAnnEqualAnnExportAnnFamilyAnnForallAnnForallUUnicode variant
AnnForeignAnnFunIdfor function name in matches where there are multiple equations for the function.
AnnGroupAnnHeaderfor CType
AnnHidingAnnIfAnnImportAnnInAnnInfixinfixorinfixlorinfixrAnnInstanceAnnLamAnnLarrow<-AnnLarrowU<-, unicode variantAnnLetAnnLollyUThe
⊸unicode arrowAnnMdoAnnMinusAnnModuleAnnNewtypeAnnNamewhere a name loses its location in the AST, this carries it
AnnOfAnnOpen'{-# DEPRECATED' etc. Opening of pragmas where the capitalisation of the string can be changed by the user. The actual text used is stored in a
SourceTexton the relevant pragma item.AnnOpenB'(|'
AnnOpenBU'(|', unicode variant
AnnOpenC'{'
AnnOpenE'[e|' or '[e||'
AnnOpenEQ'[|'
AnnOpenEQU'[|', unicode variant
AnnOpenP'('
AnnOpenS'['
AnnOpenPH'(#'
AnnDollarprefix $ -- TemplateHaskell
AnnDollarDollarprefix $$ -- TemplateHaskell
AnnPackageNameAnnPatternAnnPercent%-- for HsExplicitMultAnnPercentOne'%1' -- for HsLinearArrow
AnnProcAnnQualifiedAnnRarrow->AnnRarrowU->, unicode variantAnnRecAnnRoleAnnSafeAnnSemi';'
AnnSimpleQuote'''
AnnSignatureAnnStaticstaticAnnStockAnnThenAnnThTyQuotedouble '''
AnnTildeAnnTypeAnnUnit()for typesAnnUsingAnnVale.g. INTEGER
AnnValStrString value, will need quotes when output
AnnVbar|AnnViaviaAnnWhereAnnlarrowtail-<AnnlarrowtailU-<, unicode variantAnnrarrowtail->AnnrarrowtailU->, unicode variantAnnLarrowtail-<<AnnLarrowtailU-<<, unicode variantAnnRarrowtail>>-AnnRarrowtailU>>-, unicode variant
Instances6Eq, Data, Ord, Show, NoAnn, Outputable
Eq AnnKeywordIdDefined in ghc-9.10.3 · GHC.Parser.AnnotationData AnnKeywordIdDefined in ghc-9.10.3 · GHC.Parser.AnnotationOrd AnnKeywordIdDefined in ghc-9.10.3 · GHC.Parser.AnnotationShow AnnKeywordIdDefined in ghc-9.10.3 · GHC.Parser.AnnotationNoAnn AnnKeywordIdDefined in ghc-9.10.3 · GHC.Parser.AnnotationOutputable AnnKeywordIdDefined in ghc-9.10.3 · GHC.Parser.Annotation