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-lib-parser-9.14.1.20251220GHC2021

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

Instances1173Eq, CollectPass, MapXRec, UnXRec, HasOccName, CollectBinders, …
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
  • IsPass 'ParsedDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Hs.Extension
  • IsPass 'RenamedDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Hs.Extension
  • IsPass 'TypecheckedDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Hs.Extension

Orphan instances

2 instances