A Haskell source module.
Constructors
HsModule SrcLoc Module (Maybe [HsExportSpec]) [HsImportDecl] [HsDecl]
:: a typeCtrl KGHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05
Modulehaskell-src-1.0.4.1Haskell98
A suite of datatypes describing the abstract syntax of Haskell 98 plus a few extensions:
multi-parameter type classes
parameters of type class assertions are unrestricted
A Haskell source module.
HsModule SrcLoc Module (Maybe [HsExportSpec]) [HsImportDecl] [HsDecl]Export specification.
HsEVar HsQNameVariable.
HsEAbs HsQNameT:
A class or datatype exported abstractly,
or a type synonym.
HsEThingAll HsQNameT(..):
A class exported with all of its methods, or
a datatype exported with all of its constructors.
HsEThingWith HsQName [HsCName]T(C_1,...,C_n):
A class exported with some of its methods, or
a datatype exported with some of its constructors.
HsEModuleContents Modulemodule M:
Re-export a module.
Eq HsExportSpecDefined in haskell-src-1.0.4.1 · Language.Haskell.SyntaxData HsExportSpecDefined in haskell-src-1.0.4.1 · Language.Haskell.SyntaxShow HsExportSpecDefined in haskell-src-1.0.4.1 · Language.Haskell.SyntaxPretty HsExportSpecDefined in haskell-src-1.0.4.1 · Language.Haskell.PrettyImport declaration.
HsImportDeclimportLoc :: SrcLocPosition of the import keyword.
importModule :: ModuleName of the module imported.
importQualified :: BoolImported qualified?
importAs :: Maybe ModuleOptional alias name in an as clause.
importSpecs :: Maybe (Bool, [HsImportSpec])Eq HsImportDeclDefined in haskell-src-1.0.4.1 · Language.Haskell.SyntaxData HsImportDeclDefined in haskell-src-1.0.4.1 · Language.Haskell.SyntaxShow HsImportDeclDefined in haskell-src-1.0.4.1 · Language.Haskell.SyntaxPretty HsImportDeclDefined in haskell-src-1.0.4.1 · Language.Haskell.PrettyImport specification.
HsIVar HsNameVariable.
HsIAbs HsNameT:
The name of a class, datatype or type synonym.
HsIThingAll HsNameT(..):
A class imported with all of its methods, or
a datatype imported with all of its constructors.
HsIThingWith HsName [HsCName]T(C_1,...,C_n):
A class imported with some of its methods, or
a datatype imported with some of its constructors.
Eq HsImportSpecDefined in haskell-src-1.0.4.1 · Language.Haskell.SyntaxData HsImportSpecDefined in haskell-src-1.0.4.1 · Language.Haskell.SyntaxShow HsImportSpecDefined in haskell-src-1.0.4.1 · Language.Haskell.SyntaxPretty HsImportSpecDefined in haskell-src-1.0.4.1 · Language.Haskell.PrettyAssociativity of an operator.
HsAssocNoneNon-associative operator (declared with infix).
HsAssocLeftLeft-associative operator (declared with infixl).
HsAssocRightRight-associative operator (declared with infixr).
HsTypeDecl SrcLoc HsName [HsName] HsTypeHsDataDecl SrcLoc HsContext HsName [HsName] [HsConDecl] [HsQName]HsInfixDecl SrcLoc HsAssoc Int [HsOp]HsNewTypeDecl SrcLoc HsContext HsName [HsName] HsConDecl [HsQName]HsClassDecl SrcLoc HsContext HsName [HsName] [HsDecl]HsInstDecl SrcLoc HsContext HsQName [HsType] [HsDecl]HsDefaultDecl SrcLoc [HsType]HsTypeSig SrcLoc [HsName] HsQualTypeHsFunBind [HsMatch]HsPatBind SrcLoc HsPat HsRhs [HsDecl]HsForeignImport SrcLoc String HsSafety String HsName HsTypeHsForeignExport SrcLoc String String HsName HsTypeDeclaration of a data constructor.
HsConDecl SrcLoc HsName [HsBangType]Ordinary data constructor.
HsRecDecl SrcLoc HsName [([HsName], HsBangType)]Record constructor.
The type of a constructor argument or field, optionally including a strictness annotation.
HsBangedTy HsTypeStrict component, marked with "!".
HsUnBangedTy HsTypeNon-strict component.
Eq HsBangTypeDefined in haskell-src-1.0.4.1 · Language.Haskell.SyntaxData HsBangTypeDefined in haskell-src-1.0.4.1 · Language.Haskell.SyntaxShow HsBangTypeDefined in haskell-src-1.0.4.1 · Language.Haskell.SyntaxPretty HsBangTypeDefined in haskell-src-1.0.4.1 · Language.Haskell.PrettyThe right hand side of a function or pattern binding.
HsUnGuardedRhs HsExpUnguarded right hand side (exp).
HsGuardedRhss [HsGuardedRhs]Guarded right hand side (gdrhs).
A guarded right hand side | exp = exp.
The first expression will be Boolean-valued.
Eq HsGuardedRhsDefined in haskell-src-1.0.4.1 · Language.Haskell.SyntaxData HsGuardedRhsDefined in haskell-src-1.0.4.1 · Language.Haskell.SyntaxShow HsGuardedRhsDefined in haskell-src-1.0.4.1 · Language.Haskell.SyntaxPretty HsGuardedRhsDefined in haskell-src-1.0.4.1 · Language.Haskell.PrettySafety level for invoking a foreign entity.
Eq HsSafetyDefined in haskell-src-1.0.4.1 · Language.Haskell.SyntaxData HsSafetyDefined in haskell-src-1.0.4.1 · Language.Haskell.SyntaxOrd HsSafetyDefined in haskell-src-1.0.4.1 · Language.Haskell.SyntaxShow HsSafetyDefined in haskell-src-1.0.4.1 · Language.Haskell.SyntaxPretty HsSafetyDefined in haskell-src-1.0.4.1 · Language.Haskell.PrettyA type qualified with a context. An unqualified type has an empty context.
Eq HsQualTypeDefined in haskell-src-1.0.4.1 · Language.Haskell.SyntaxData HsQualTypeDefined in haskell-src-1.0.4.1 · Language.Haskell.SyntaxShow HsQualTypeDefined in haskell-src-1.0.4.1 · Language.Haskell.SyntaxPretty HsQualTypeDefined in haskell-src-1.0.4.1 · Language.Haskell.PrettyClass assertions. In Haskell 98, the argument would be a tyvar, but this definition allows multiple parameters, and allows them to be types.
Haskell types and type constructors.
Haskell expressions.
Notes:
Because it is difficult for parsers to distinguish patterns from expressions, they typically parse them in the same way and then check that they have the appropriate form. Hence the expression type includes some forms that are found only in patterns. After these checks, these constructors should not be used.
The parser does not take precedence and associativity into account, so it will leave HsInfixApps associated to the left.
The Pretty instance for HsExp does not add parentheses in printing.
HsVar HsQNameVariable.
HsCon HsQNameData constructor.
HsLit HsLiteralLiteral constant.
HsInfixApp HsExp HsQOp HsExpInfix application.
HsApp HsExp HsExpOrdinary application.
HsNegApp HsExpNegation expression - exp.
HsLambda SrcLoc [HsPat] HsExpLambda expression.
HsLet [HsDecl] HsExpLocal declarations with let.
HsIf HsExp HsExp HsExpIf exp then exp else exp.
HsCase HsExp [HsAlt]Case exp of alts.
HsDo [HsStmt]Do-expression:
The last statement in the list
should be an expression.
HsTuple [HsExp]Tuple expression.
HsList [HsExp]List expression.
HsParen HsExpParenthesized expression.
HsLeftSection HsExp HsQOpLeft section (exp qop).
HsRightSection HsQOp HsExpRight section (qop exp).
HsRecConstr HsQName [HsFieldUpdate]Record construction expression.
HsRecUpdate HsExp [HsFieldUpdate]Record update expression.
HsEnumFrom HsExpUnbounded arithmetic sequence, incrementing by 1.
HsEnumFromTo HsExp HsExpBounded arithmetic sequence, incrementing by 1.
HsEnumFromThen HsExp HsExpUnbounded arithmetic sequence, with first two elements given.
HsEnumFromThenTo HsExp HsExp HsExpBounded arithmetic sequence, with first two elements given.
HsListComp HsExp [HsStmt]List comprehension.
HsExpTypeSig SrcLoc HsExp HsQualTypeExpression type signature.
HsAsPat HsName HsExp(patterns only)
HsWildCard(patterns only)
HsIrrPat HsExp(patterns only)
This type represents both stmt in a do-expression,
and qual in a list comprehension.
HsGenerator SrcLoc HsPat HsExpA generator pat <- exp.
HsQualifier HsExpAn exp by itself: in a do-expression,
an action whose result is discarded;
in a list comprehension, a guard expression.
HsLetStmt [HsDecl]Local bindings.
An fbind in a labeled record construction or update expression.
Eq HsFieldUpdateDefined in haskell-src-1.0.4.1 · Language.Haskell.SyntaxData HsFieldUpdateDefined in haskell-src-1.0.4.1 · Language.Haskell.SyntaxShow HsFieldUpdateDefined in haskell-src-1.0.4.1 · Language.Haskell.SyntaxPretty HsFieldUpdateDefined in haskell-src-1.0.4.1 · Language.Haskell.PrettyAn alt in a case expression.
HsUnGuardedAlt HsExp-> exp.
HsGuardedAlts [HsGuardedAlt]gdpat.
Eq HsGuardedAltsDefined in haskell-src-1.0.4.1 · Language.Haskell.SyntaxData HsGuardedAltsDefined in haskell-src-1.0.4.1 · Language.Haskell.SyntaxShow HsGuardedAltsDefined in haskell-src-1.0.4.1 · Language.Haskell.SyntaxPretty HsGuardedAltsDefined in haskell-src-1.0.4.1 · Language.Haskell.PrettyA guarded alternative | exp -> exp.
The first expression will be Boolean-valued.
Eq HsGuardedAltDefined in haskell-src-1.0.4.1 · Language.Haskell.SyntaxData HsGuardedAltDefined in haskell-src-1.0.4.1 · Language.Haskell.SyntaxShow HsGuardedAltDefined in haskell-src-1.0.4.1 · Language.Haskell.SyntaxPretty HsGuardedAltDefined in haskell-src-1.0.4.1 · Language.Haskell.PrettyA pattern, to be matched against a value.
HsPVar HsNameVariable.
HsPLit HsLiteralLiteral constant.
HsPNeg HsPatNegated pattern.
HsPInfixApp HsPat HsQName HsPatPattern with infix data constructor.
HsPApp HsQName [HsPat]Data constructor and argument patterns.
HsPTuple [HsPat]Tuple pattern.
HsPList [HsPat]List pattern.
HsPParen HsPatParenthesized pattern.
HsPRec HsQName [HsPatField]Labelled pattern.
HsPAsPat HsName HsPat@-Pattern.
HsPWildCardWildcard pattern (_).
HsPIrrPat HsPatIrrefutable pattern (~).
An fpat in a labeled record pattern.
Eq HsPatFieldDefined in haskell-src-1.0.4.1 · Language.Haskell.SyntaxData HsPatFieldDefined in haskell-src-1.0.4.1 · Language.Haskell.SyntaxShow HsPatFieldDefined in haskell-src-1.0.4.1 · Language.Haskell.SyntaxPretty HsPatFieldDefined in haskell-src-1.0.4.1 · Language.Haskell.Prettyliteral.
Values of this type hold the abstract value of the literal, not the
precise string representation used. For example, 10, 0o12 and 0xa
have the same representation.
HsChar CharCharacter literal.
HsString StringString literal.
HsInt IntegerInteger literal.
HsFrac RationalFloating point literal.
HsCharPrim CharGHC unboxed character literal.
HsStringPrim StringGHC unboxed string literal.
HsIntPrim IntegerGHC unboxed integer literal.
HsFloatPrim RationalGHC unboxed float literal.
HsDoublePrim RationalGHC unboxed double literal.
Eq ModuleDefined in haskell-src-1.0.4.1 · Language.Haskell.SyntaxData ModuleDefined in haskell-src-1.0.4.1 · Language.Haskell.SyntaxOrd ModuleDefined in haskell-src-1.0.4.1 · Language.Haskell.SyntaxShow ModuleDefined in haskell-src-1.0.4.1 · Language.Haskell.SyntaxPretty ModuleDefined in haskell-src-1.0.4.1 · Language.Haskell.PrettyThis type is used to represent qualified variables, and also qualified constructors.
Eq HsQNameDefined in haskell-src-1.0.4.1 · Language.Haskell.SyntaxData HsQNameDefined in haskell-src-1.0.4.1 · Language.Haskell.SyntaxOrd HsQNameDefined in haskell-src-1.0.4.1 · Language.Haskell.SyntaxShow HsQNameDefined in haskell-src-1.0.4.1 · Language.Haskell.SyntaxPretty HsQNameDefined in haskell-src-1.0.4.1 · Language.Haskell.PrettyThis type is used to represent variables, and also constructors.
Eq HsNameDefined in haskell-src-1.0.4.1 · Language.Haskell.SyntaxData HsNameDefined in haskell-src-1.0.4.1 · Language.Haskell.SyntaxOrd HsNameDefined in haskell-src-1.0.4.1 · Language.Haskell.SyntaxShow HsNameDefined in haskell-src-1.0.4.1 · Language.Haskell.SyntaxPretty HsNameDefined in haskell-src-1.0.4.1 · Language.Haskell.PrettyPossibly qualified infix operators (qop), appearing in expressions.
Eq HsQOpDefined in haskell-src-1.0.4.1 · Language.Haskell.SyntaxData HsQOpDefined in haskell-src-1.0.4.1 · Language.Haskell.SyntaxOrd HsQOpDefined in haskell-src-1.0.4.1 · Language.Haskell.SyntaxShow HsQOpDefined in haskell-src-1.0.4.1 · Language.Haskell.SyntaxPretty HsQOpDefined in haskell-src-1.0.4.1 · Language.Haskell.PrettyOperators, appearing in infix declarations.
Eq HsOpDefined in haskell-src-1.0.4.1 · Language.Haskell.SyntaxData HsOpDefined in haskell-src-1.0.4.1 · Language.Haskell.SyntaxOrd HsOpDefined in haskell-src-1.0.4.1 · Language.Haskell.SyntaxShow HsOpDefined in haskell-src-1.0.4.1 · Language.Haskell.SyntaxPretty HsOpDefined in haskell-src-1.0.4.1 · Language.Haskell.PrettyConstructors with special syntax. These names are never qualified, and always refer to builtin type or data constructors.
Eq HsSpecialConDefined in haskell-src-1.0.4.1 · Language.Haskell.SyntaxData HsSpecialConDefined in haskell-src-1.0.4.1 · Language.Haskell.SyntaxOrd HsSpecialConDefined in haskell-src-1.0.4.1 · Language.Haskell.SyntaxShow HsSpecialConDefined in haskell-src-1.0.4.1 · Language.Haskell.SyntaxA name (cname) of a component of a class or data type in an import
or export specification.
Eq HsCNameDefined in haskell-src-1.0.4.1 · Language.Haskell.SyntaxData HsCNameDefined in haskell-src-1.0.4.1 · Language.Haskell.SyntaxOrd HsCNameDefined in haskell-src-1.0.4.1 · Language.Haskell.SyntaxShow HsCNameDefined in haskell-src-1.0.4.1 · Language.Haskell.SyntaxPretty HsCNameDefined in haskell-src-1.0.4.1 · Language.Haskell.Pretty