HORIZON HASKELLDocslts/ghc-9.14.x45dd5372026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 9.14.1 · lts/ghc-9.14.x · 45dd537 · 2026-10-11

Moduleghc-9.14.1GHC2021

GHC.Hs.Extension

  • 10 types
  • 1 class
  • 3 values
  • Packageghc-9.14.1
  • Exports17
  • LanguageGHC2021
  • LicenceBSD-3-Clause
  • SourceExtension.hs
datadata GhcPass (c :: Pass) where
#

Used as a data type index for the hsSyn AST; also serves as a singleton type for Pass

Instances1269CvtFlag, Eq, CollectPass, MapXRec, UnXRec, HasOccName, …
classclass (NoGhcTcPass (NoGhcTcPass p) ~ NoGhcTcPass p, IsPass (NoGhcTcPass p)) => IsPass (p :: Pass) where
#

Allows us to check what phase we're in at GHC's runtime. For example, this class allows us to write

f :: forall p. IsPass p => HsExpr (GhcPass p) -> blah
f e = case ghcPass @p of
        GhcPs ->    ... in this RHS we have HsExpr GhcPs...
        GhcRn ->    ... in this RHS we have HsExpr GhcRn...
        GhcTc ->    ... in this RHS we have HsExpr GhcTc...

which is very useful, for example, when pretty-printing. See Note [IsPass].

Methods

Instances3IsPass

Orphan instances

2 instances