Skip to content

Document or remove source pragmas

GHC supports several pragmas to be interleaved with expressions, as used with this AST node:

  -- Expressions annotated with pragmas, written as {-# ... #-}
  | HsPragE (XPragE p) (HsPragE p) (LHsExpr p)

Here is the HsPragE type:

data HsPragE p
  = HsPragSCC   ...
  | HsPragCore  ...
  | HsPragTick  ...
  | XHsPragE (XXPragE p)

HsPragSCC feels familiar. I'm worried about the other two possibilities here. GHC parses them:

prag_e :: { Located ([AddAnn], HsPragE GhcPs) }
      : '{-# SCC' STRING '#-}'      { ... }
      | '{-# SCC' VARID  '#-}'      { ... }
      | '{-# GENERATED' STRING INTEGER ':' INTEGER '-' INTEGER ':' INTEGER '#-}'
                                      { ... HsPragTick ... }
      | '{-# CORE' STRING '#-}'
            { ... HsPragCore ... }

Yet the strings CORE and GENERATED (in caps) never appear in the manual.

Are these used? If so, we should document them. If not, we should remove them.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information