Safe Haskell | None |
---|
Declares the basic syntax of a Haskell98 subset enriched with higher-ranked functions. Additionally, it defines small convenience functions.
- data Declaration
- getDeclarationName :: Declaration -> Identifier
- getDeclarationArity :: Declaration -> Maybe Int
- data TypeDeclaration = Type {}
- data DataDeclaration = Data {}
- data NewtypeDeclaration = Newtype {}
- data ClassDeclaration = Class {
- superClasses :: [TypeClass]
- className :: Identifier
- classVar :: TypeVariable
- classFuns :: [Signature]
- data Signature = Signature {}
- newtype Identifier = Ident {}
- data DataConstructorDeclaration = DataCon {}
- data BangTypeExpression
- data TypeExpression
- data TypeConstructor
- newtype TypeClass = TC Identifier
- newtype TypeVariable = TV Identifier
- newtype FixedTypeExpression = TF Identifier
Documentation
data Declaration Source
A Haskell declaration which corresponds to a type
, data
, newtype
,
class
or type signature declaration.
In type expressions, type variables must not be applied to type
expressions. Thus, for example, the functions of the Monad
class are not
expressible.
However, in extension to Haskell98, higher-rank types can be expressed.
This data type does not reflect all information of a declaration. Only the aspects needed by the FreeTheorems library are covered.
TypeDecl TypeDeclaration | A |
DataDecl DataDeclaration | A |
NewtypeDecl NewtypeDeclaration | A |
ClassDecl ClassDeclaration | A |
TypeSig Signature | A type signature. |
getDeclarationName :: Declaration -> IdentifierSource
Gets the name of the item declared by a declaration.
This is the type constructor for data
, newtype
and type
declarations,
the name of a class for a class
declaration or the name of a type
signature.
getDeclarationArity :: Declaration -> Maybe IntSource
Gets the arity of a type constructor or Nothing
if this is not a
data
, newtype
or type
declaration.
data TypeDeclaration Source
A type
declaration for a type synonym.
Type | |
|
data DataDeclaration Source
A data
declaration for an algebraic data type.
Note that the context and the deriving parts of a data
declaration are
ignored.
Data | |
|
data NewtypeDeclaration Source
A newtype
declaration for a type renaming.
Note that the context and the deriving parts of a newtype
declaration are
ignored.
Newtype | |
|
data ClassDeclaration Source
A class
declaration for a type class.
Note that, except of type signatures of class methods, all other declarations inside the class are ignored.
Class | |
|
A type signature.
Signature | |
|
newtype Identifier Source
An identifier.
This data type tags every String
occurring in a declaration or a type
expression.
data DataConstructorDeclaration Source
A data constructor declaration.
DataCon | |
|
data BangTypeExpression Source
Indicates whether in an algebraic data type declaration a strictness annotation is used.
data TypeExpression Source
A Haskell type expression. This data type supports also higher-rank functions. Unlike in Haskell98, a type variable must not be applied to type expressions.
TypeVar TypeVariable | A type variable. |
TypeCon TypeConstructor [TypeExpression] | A type constructor. This covers algebraic data types, type synonyms, and type renamings as well as predefined standard data types like lists and tuples. |
TypeFun TypeExpression TypeExpression | The function type constructor |
TypeFunLab TypeExpression TypeExpression | The function type constructor |
TypeAbs TypeVariable [TypeClass] TypeExpression | The type abstraction constructor |
TypeAbsLab TypeVariable [TypeClass] TypeExpression | The type abstraction constructor |
TypeExp FixedTypeExpression | A variable representing a fixed type expression. |
data TypeConstructor Source
The data type for type constructors.
ConUnit | The unit type constructor |
ConList | The list type constructor |
ConTuple Int | The tuple type constructors with given arity. |
ConInt | The Haskell type |
ConInteger | The Haskell type |
ConFloat | The Haskell type |
ConDouble | The Haskell type |
ConChar | The Haskell type |
Con Identifier | Any other type constructor with a given name. |
Identifies a Haskell type class.
newtype TypeVariable Source
Identifies a Haskell type variable
newtype FixedTypeExpression Source
Represents an abbreviation for some fixed type expression. It does not occur in Haskell98 source code, but it can occur in generated theorems.