HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Moduleghc-9.10.3GHC2021

GHC.Hs.Decls

Abstract syntax of global declarations.

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

  • 77 types
  • 51 values
  • Packageghc-9.10.3
  • Exports128
  • LanguageGHC2021
  • LicenceBSD-3-Clause
  • SourceDecls.hs

Toplevel declarations

15 declarations
datadata HsDecl p
#

A Haskell Declaration

Constructors

Instances7Data, Outputable, HasHaddock, Anno, …
datadata HsDataDefn pass
#

Haskell Data type Definition

Constructors

Instances8Data, HasLoc, Outputable, ToHie, HasHaddock, …
datadata HsDerivingClause pass
#

A single deriving clause of a data declaration.

Constructors

Instances9Data, Outputable, ToHie, 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

Instances7Data, Outputable, ToHie, HasHaddock, Anno, …
datadata NewOrData
#

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

Instances3Eq, Data, Outputable
datadata StandaloneKindSig pass
#
Instances7Data, Outputable, ToHie, Anno, …

Class or type declarations

datadata TyClDecl pass
#

A type or class declaration.

Constructors

Instances6Data, Outputable, ToHie, Anno
datadata TyClGroup pass
#
Instances5Data, Outputable, ToHie

Does this declaration have a complete, user-supplied kind signature? See Note [CUSKs: complete user-supplied kind signatures]

datadata FamilyDecl pass
#
Instances6Data, Outputable, ToHie, Anno
datadata FunDep pass
#

Constructors

Instances6Data, Outputable, ToHie, Anno

Instance declarations

datadata InstDecl pass
#
Instances6Data, Outputable, ToHie, Anno
datadata FamilyInfo pass
#

Constructors

Instances5Data, Outputable, ToHie
datadata TyFamInstDecl pass
#

Type Family Instance Declaration

Instances6Data, Outputable, ToHie, Anno
newtypenewtype DataFamInstDecl pass
#

Data Family Instance Declaration

Constructors

Instances6Data, Outputable, ToHie, 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

Instances10Data, HasLoc, ToHie, 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
#

Class Instance Declaration - AnnKeywordId : AnnInstance, AnnWhere, AnnOpen,AnnClose, For details on above see Note [exact print annotations] in GHC.Parser.Annotation

Instances6Data, Outputable, ToHie, Anno

Standalone deriving declarations

datadata DerivDecl pass
#

Stand-alone 'deriving instance' declaration

Constructors

Instances6Data, Outputable, ToHie, Anno

Deriving strategies

datadata DerivStrategy pass
#

Which technique the user explicitly requested when deriving an instance.

Constructors

Instances6Data, Outputable, ToHie, Anno

RULE declarations

datadata RuleDecls pass
#

Rule Declarations

Instances6Data, Outputable, ToHie, Anno
datadata RuleDecl pass
#

Rule Declaration

Constructors

Instances6Data, Outputable, ToHie, Anno
datadata HsRuleAnn
#

Constructors

Instances3Eq, Data, NoAnn
datadata RuleBndr pass
#

Rule Binder

Instances6Data, Outputable, ToHie, Anno

default declarations

datadata DefaultDecl pass
#

Default Declaration

Instances6Data, Outputable, ToHie, Anno

Template haskell declaration splice

datadata SpliceDecoration
#

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
#
Instances6Data, Outputable, ToHie, Anno

Foreign function interface declarations

datadata ForeignDecl pass
#
Instances6Data, Outputable, ToHie, Anno
datadata ForeignImport pass
#
Instances5Data, Outputable, ToHie
datadata ForeignExport pass
#
Instances5Data, Outputable, ToHie

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

Instances7Data, Outputable, ToHie, 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.)

Instances4Data, ToHie

Document comments

datadata DocDecl pass
#

Documentation comment Declaration

Instances4Data, Outputable, ToHie, Anno

Deprecations

datadata WarnDecl pass
#

Warning pragma Declaration

Constructors

Instances6Data, Outputable, ToHie, Anno
datadata WarnDecls pass
#

Warning pragma Declarations

Instances6Data, Outputable, ToHie, Anno

Annotations

datadata AnnDecl pass
#

Annotation Declaration

Instances6Data, Outputable, ToHie, Anno

Role annotations

datadata RoleAnnotDecl pass
#

Role Annotation Declaration

Instances6Data, Outputable, ToHie, Anno

Injective type families

datadata FamilyResultSig pass
#
Instances5Data, ToHie, 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]"

Instances5Data, ToHie, Anno

Grouping

7 declarations
datadata HsGroup p
#

Haskell Group

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

Instances4Data, Outputable

Orphan instances

33 instances