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

GHC 10.0.0.20260917 · lts/ghc-10.0.x · fc4e598 · 2026-10-11

Moduleghc-10.0.0.20260917GHC2024

GHC.Hs.Extension

  • 10 types
  • 1 class
  • 3 values
datadata GhcPass (c :: Pass) where
#

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

Instances1371CvtFlag, Eq, NFData, CollectPass, MapXRec, UnXRec, …
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