HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Moduleghc-9.10.3GHC2021

GHC.Types.Error.Codes

Defines diagnostic codes for the diagnostics emitted by GHC.

A diagnostic code is a numeric unique identifier for a diagnostic. See Note [Diagnostic codes].

  • 2 values
  • Packageghc-9.10.3
  • Exports3
  • LanguageGHC2021
  • LicenceBSD-3-Clause
  • SourceCodes.hs
familytype family GhcDiagnosticCode (c :: Symbol) :: Nat where
#

Type family computing the numeric diagnostic code for a given error message constructor.

Its injectivity annotation ensures uniqueness of error codes.

Never remove a return value from this type family! Outdated error messages must still be tracked here to ensure uniqueness of diagnostic codes across GHC versions.

See Note [Diagnostic codes] in GHC.Types.Error.

Equations

valueconstructorCodes :: (Generic diag, GDiagnosticCodes '[diag] (Rep diag)) => Map DiagnosticCode String
#

This function computes all diagnostic codes that occur inside a given type using generics and the GhcDiagnosticCode type family.

For example, if T = MkT1 | MkT2, GhcDiagnosticCode "MkT1" = 123 and GhcDiagnosticCode "MkT2" = 456, then we will get > constructorCodes @T = fromList [ (123, "MkT1"), (456, "MkT2") ]