
From the parser/annotation point of view, the appropriate annotations are generated, and can be used to distinguish the two cases. The problem is
I am in the process of working the shiny new API annotations through into a practical example in ghc-exactprint [1], but I have hit a snag. A SCC annotation appears in the source as {-# SCC "name" #-} <expression> and if enabled via -prof results in the expression being wrapped in HsSCC FastString (LHsExpr id) BUT, if not enabled, it appears as HsPar (LHsExpr id) that the annotations only capture the SrcSpan of the thing being annotated, so in the HsPar case the contents of the FastString is lost. A similar situation exists for HsTickPragma, HsTickPragma -- A pragma introduced tick (FastString,(Int,Int),(Int,Int)) -- external span for this tick (LHsExpr id) which also degrades to HsPar I see a number of possible solutions 1. Add the missing information to HsPar in a Maybe HsPar (Maybe (FastString,(Int,Int),(Int,Int))) (LHsExpr id) 2. Modify HsSCC / HsTickPragma to have a Bool indicating whether they are active or not. 3. Introduce an additional annotation type to carry the missing information. I welcome advice on the best way forward. Alan [1] https://github.com/alanz/ghc-exactprint/tree/wip