HORIZON HASKELLDocslts/ghc-10.0.x77a86622026-10-31Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 77a8662 · 2026-10-31

Moduleghc-lib-parser-9.14.1.20251220GHC2021

Language.Haskell.Syntax.Decls

Abstract syntax of global declarations.

Definitions for: SynDecl and ConDecl, ClassDecl, InstDecl, DefaultDecl and ForeignDecl.

Contents
  1. Toplevel declarations
  2. Class or type declarations
  3. Instance declarations
  4. Standalone deriving declarations
  5. Deriving strategies
  6. RULE declarations
  7. default declarations
  8. Template haskell declaration splice
  9. Foreign function interface declarations
  10. Data-constructor declarations
  11. Document comments
  12. Deprecations
  13. Annotations
  14. Role annotations
  15. Injective type families
  16. Grouping
Synopsis

Toplevel declarations

datadata HsDecl p

A Haskell Declaration

Constructors

Instances7Data, Outputable, HasHaddock, Anno, …
  • Data (HsDecl GhcPs)Defined in ghc-lib-parser-9.14.1.20251220 · GHC.Hs.Instances · orphan
  • Data (HsDecl GhcRn)Defined in ghc-lib-parser-9.14.1.20251220 · GHC.Hs.Instances · orphan
  • Data (HsDecl GhcTc)Defined in ghc-lib-parser-9.14.1.20251220 · GHC.Hs.Instances · orphan
  • OutputableBndrId p => Outputable (HsDecl (GhcPass p))Defined in ghc-lib-parser-9.14.1.20251220 · GHC.Hs.Decls · orphan
  • HasHaddock (LocatedA (HsDecl GhcPs))Defined in ghc-lib-parser-9.14.1.20251220 · GHC.Parser.PostProcess.Haddock
  • HasHaddock (HsDecl GhcPs)Defined in ghc-lib-parser-9.14.1.20251220 · GHC.Parser.PostProcess.Haddock
  • type Anno (HsDecl (GhcPass _1)) = SrcSpanAnnADefined in ghc-lib-parser-9.14.1.20251220 · GHC.Hs.Decls · orphan
datadata HsDataDefn pass

Haskell Data type Definition

Constructors

Instances5Data, Outputable, HasHaddock
datadata FunDep pass
#

Constructors

Instances5Data, Outputable, Anno
datadata HsDerivingClause pass

A single deriving clause of a data declaration.

Constructors

Instances7Data, Outputable, HasHaddock, Anno, …
datadata DerivClauseTys pass

The types mentioned in a single deriving clause. This can come in two forms, DctSingle or DctMulti, depending on whether the types are surrounded by enclosing parentheses or not. These parentheses are semantically different than HsParTy. For example, deriving () means "derive zero classes" rather than "derive an instance of the 0-tuple".

DerivClauseTys use LHsSigType because deriving clauses can mention type variables that aren't bound by the datatype, e.g.

data T b = ... deriving (C [a])

should produce a derived instance for C [a] (T b).

Constructors

Instances6Data, Outputable, HasHaddock, Anno
datadata NewOrData

When we only care whether a data-type declaration is data or newtype, but not what constructors it has.

Constructors

Instances3Eq, Data, Outputable
  • Eq NewOrDataDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Types.Basic
  • Data NewOrDataDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Types.Basic
  • Outputable NewOrDataDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Types.Basic
datadata DataDefnCons a

Whether a data-type declaration is data or newtype, and its constructors.

Constructors

Instances5Functor, Foldable, Traversable, Eq, Data
  • Functor DataDefnConsDefined in ghc-lib-parser-9.14.1.20251220 · Language.Haskell.Syntax.Decls
  • Foldable DataDefnConsDefined in ghc-lib-parser-9.14.1.20251220 · Language.Haskell.Syntax.Decls
  • Traversable DataDefnConsDefined in ghc-lib-parser-9.14.1.20251220 · Language.Haskell.Syntax.Decls
  • Eq a => Eq (DataDefnCons a)Defined in ghc-lib-parser-9.14.1.20251220 · Language.Haskell.Syntax.Decls
  • Data a => Data (DataDefnCons a)Defined in ghc-lib-parser-9.14.1.20251220 · Language.Haskell.Syntax.Decls
datadata StandaloneKindSig pass
#
Instances5Data, Outputable, Anno

Class or type declarations

datadata TyClDecl pass

A type or class declaration.

Constructors

Instances5Data, Outputable, Anno
datadata TyClGroup pass
Instances4Data, Outputable
datadata FamilyDecl pass
Instances5Data, Outputable, Anno

Instance declarations

datadata InstDecl pass
Instances5Data, Outputable, Anno
datadata FamilyInfo pass
#

Constructors

Instances4Data, Outputable
datadata TyFamInstDecl pass

Type Family Instance Declaration

Instances5Data, Outputable, Anno
newtypenewtype DataFamInstDecl pass

Data Family Instance Declaration

Constructors

Instances5Data, Outputable, Anno
datadata FamEqn pass rhs

Family Equation

One equation in a type family instance declaration, data family instance declaration, or type family default. See Note [Type family instance declarations in HsSyn] See Note [Family instance declaration binders]

Constructors

Instances5Data, Anno
typetype HsFamEqnPats pass = [LHsTypeArg pass]

HsFamEqnPats represents patterns on the left-hand side of a type instance, e.g. `type instance F k (a :: k) = a` has patterns `k` and `(a :: k)`.

HsFamEqnPats used to be called HsTyPats but it was renamed to avoid confusion with a different notion of type patterns, see #23657.

datadata ClsInstDecl pass
Instances5Data, Outputable, Anno

Standalone deriving declarations

datadata DerivDecl pass

Stand-alone 'deriving instance' declaration

Constructors

Instances5Data, Outputable, Anno

Deriving strategies

datadata DerivStrategy pass

Which technique the user explicitly requested when deriving an instance.

Constructors

Instances5Data, Outputable, Anno

RULE declarations

datadata RuleDecls pass

Rule Declarations

Instances5Data, Outputable, Anno
datadata RuleDecl pass

Rule Declaration

Constructors

Instances5Data, Outputable, Anno
datadata RuleBndr pass

Rule Binder

Constructors

Instances5Data, Outputable, Anno

default declarations

datadata DefaultDecl pass

Default Declaration

Instances5Data, Outputable, Anno

Template haskell declaration splice

A splice can appear with various decorations wrapped around it. This data type captures explicitly how it was originally written, for use in the pretty printer.

Constructors

Instances4Eq, Data, Show, Outputable
datadata SpliceDecl p
Instances5Data, Outputable, Anno

Foreign function interface declarations

datadata ForeignDecl pass
Instances5Data, Outputable, Anno
datadata ForeignImport pass
#
Instances4Data, Outputable
datadata ForeignExport pass
#
Instances4Data, Outputable

Data-constructor declarations

datadata ConDecl pass
data T b = forall a. Eq a => MkT a b
  MkT :: forall b a. Eq a => MkT a b

data T b where
     MkT1 :: Int -> T Int

data T = Int MkT Int
       | MkT2

data T a where
     Int MkT Int :: T Int

data Constructor Declaration

Constructors

Instances6Data, Outputable, HasHaddock, Anno
datadata HsConDeclGADTDetails pass

The arguments in a GADT constructor. Unlike Haskell98-style constructors, GADT constructors cannot be declared with infix syntax. As a result, we do not use HsConDetails here, as InfixCon would be an unrepresentable state. (There is a notion of infix GADT constructors for the purposes of derived Show instances—see Note [Infix GADT constructors] in GHC.Tc.TyCl—but that is an orthogonal concern.)

Instances3Data

Document comments

datadata DocDecl pass

Documentation comment Declaration

Instances3Data, Outputable, Anno

Deprecations

datadata WarnDecl pass

Warning pragma Declaration

Constructors

Instances5Data, Outputable, Anno
datadata WarnDecls pass

Warning pragma Declarations

Instances5Data, Outputable, Anno

Annotations

datadata AnnDecl pass

Annotation Declaration

Constructors

Instances5Data, Outputable, Anno

Role annotations

datadata RoleAnnotDecl pass

Role Annotation Declaration

Instances5Data, Outputable, Anno

Injective type families

datadata FamilyResultSig pass

type Family Result Signature

Constructors

Instances4Data, Anno
datadata InjectivityAnn pass

If the user supplied an injectivity annotation it is represented using InjectivityAnn. At the moment this is a single injectivity condition - see Note [Injectivity annotation]. `Located name` stores the LHS of injectivity condition. `[Located name]` stores the RHS of injectivity condition. Example:

type family Foo a b c = r | r -> a c where ...

This will be represented as "InjectivityAnn r [a, c]"

Instances4Data, Anno

Grouping

datadata HsGroup p

Haskell Group

A HsDecl is categorised into a HsGroup before being fed to the renamer.

Instances4Data, Outputable