Copyright | (c) 1999 - 2004 Wolfgang Lux 2005 Martin Engelke 2011 - 2015 Björn Peemöller 2014 Jan Rasmus Tikovsky 2016 Finn Teegen |
---|---|
License | BSD-3-clause |
Maintainer | bjp@informatik.uni-kiel.de |
Stability | experimental |
Portability | portable |
Safe Haskell | Safe |
Language | Haskell2010 |
This module provides the necessary data structures to maintain the parsed representation of a Curry program.
- data Module a = Module [ModulePragma] ModuleIdent (Maybe ExportSpec) [ImportDecl] [Decl a]
- data ModulePragma
- data Extension
- data KnownExtension
- data Tool
- data ExportSpec = Exporting Position [Export]
- data Export
- data ImportDecl = ImportDecl Position ModuleIdent Qualified (Maybe ModuleIdent) (Maybe ImportSpec)
- data ImportSpec
- data Import
- type Qualified = Bool
- data Interface = Interface ModuleIdent [IImportDecl] [IDecl]
- data IImportDecl = IImportDecl Position ModuleIdent
- type Arity = Int
- data IDecl
- = IInfixDecl Position Infix Precedence QualIdent
- | HidingDataDecl Position QualIdent (Maybe KindExpr) [Ident]
- | IDataDecl Position QualIdent (Maybe KindExpr) [Ident] [ConstrDecl] [Ident]
- | INewtypeDecl Position QualIdent (Maybe KindExpr) [Ident] NewConstrDecl [Ident]
- | ITypeDecl Position QualIdent (Maybe KindExpr) [Ident] TypeExpr
- | IFunctionDecl Position QualIdent (Maybe Ident) Arity QualTypeExpr
- | HidingClassDecl Position Context QualIdent (Maybe KindExpr) Ident
- | IClassDecl Position Context QualIdent (Maybe KindExpr) Ident [IMethodDecl] [Ident]
- | IInstanceDecl Position Context QualIdent InstanceType [IMethodImpl] (Maybe ModuleIdent)
- data KindExpr
- data IMethodDecl = IMethodDecl Position Ident (Maybe Arity) QualTypeExpr
- type IMethodImpl = (Ident, Arity)
- data Decl a
- = InfixDecl Position Infix (Maybe Precedence) [Ident]
- | DataDecl Position Ident [Ident] [ConstrDecl] [QualIdent]
- | ExternalDataDecl Position Ident [Ident]
- | NewtypeDecl Position Ident [Ident] NewConstrDecl [QualIdent]
- | TypeDecl Position Ident [Ident] TypeExpr
- | TypeSig Position [Ident] QualTypeExpr
- | FunctionDecl Position a Ident [Equation a]
- | ExternalDecl Position [Var a]
- | PatternDecl Position (Pattern a) (Rhs a)
- | FreeDecl Position [Var a]
- | DefaultDecl Position [TypeExpr]
- | ClassDecl Position Context Ident Ident [Decl a]
- | InstanceDecl Position Context QualIdent InstanceType [Decl a]
- type Precedence = Integer
- data Infix
- data ConstrDecl
- data NewConstrDecl
- data FieldDecl = FieldDecl Position [Ident] TypeExpr
- data CallConv
- data TypeExpr
- data QualTypeExpr = QualTypeExpr Context TypeExpr
- data Equation a = Equation Position (Lhs a) (Rhs a)
- data Lhs a
- data Rhs a
- = SimpleRhs Position (Expression a) [Decl a]
- | GuardedRhs [CondExpr a] [Decl a]
- data CondExpr a = CondExpr Position (Expression a) (Expression a)
- data Literal
- data Pattern a
- = LiteralPattern a Literal
- | NegativePattern a Literal
- | VariablePattern a Ident
- | ConstructorPattern a QualIdent [Pattern a]
- | InfixPattern a (Pattern a) QualIdent (Pattern a)
- | ParenPattern (Pattern a)
- | RecordPattern a QualIdent [Field (Pattern a)]
- | TuplePattern [Pattern a]
- | ListPattern a [Pattern a]
- | AsPattern Ident (Pattern a)
- | LazyPattern (Pattern a)
- | FunctionPattern a QualIdent [Pattern a]
- | InfixFuncPattern a (Pattern a) QualIdent (Pattern a)
- data Expression a
- = Literal a Literal
- | Variable a QualIdent
- | Constructor a QualIdent
- | Paren (Expression a)
- | Typed (Expression a) QualTypeExpr
- | Record a QualIdent [Field (Expression a)]
- | RecordUpdate (Expression a) [Field (Expression a)]
- | Tuple [Expression a]
- | List a [Expression a]
- | ListCompr (Expression a) [Statement a]
- | EnumFrom (Expression a)
- | EnumFromThen (Expression a) (Expression a)
- | EnumFromTo (Expression a) (Expression a)
- | EnumFromThenTo (Expression a) (Expression a) (Expression a)
- | UnaryMinus (Expression a)
- | Apply (Expression a) (Expression a)
- | InfixApply (Expression a) (InfixOp a) (Expression a)
- | LeftSection (Expression a) (InfixOp a)
- | RightSection (InfixOp a) (Expression a)
- | Lambda [Pattern a] (Expression a)
- | Let [Decl a] (Expression a)
- | Do [Statement a] (Expression a)
- | IfThenElse (Expression a) (Expression a) (Expression a)
- | Case CaseType (Expression a) [Alt a]
- data InfixOp a
- = InfixOp a QualIdent
- | InfixConstr a QualIdent
- data Statement a
- = StmtExpr (Expression a)
- | StmtDecl [Decl a]
- | StmtBind (Pattern a) (Expression a)
- data CaseType
- data Alt a = Alt Position (Pattern a) (Rhs a)
- data Field a = Field Position QualIdent a
- data Var a = Var a Ident
- type Context = [Constraint]
- data Constraint = Constraint QualIdent TypeExpr
- type InstanceType = TypeExpr
- data Goal a = Goal Position (Expression a) [Decl a]
Module header
Curry module
Module [ModulePragma] ModuleIdent (Maybe ExportSpec) [ImportDecl] [Decl a] |
Module pragmas
data ModulePragma Source #
Module pragma
LanguagePragma Position [Extension] | language pragma |
OptionsPragma Position (Maybe Tool) String | options pragma |
Specified language extensions, either known or unknown.
KnownExtension Position KnownExtension | a known extension |
UnknownExtension Position String | an unknown extension |
data KnownExtension Source #
Known language extensions of Curry.
AnonFreeVars | anonymous free variables |
CPP | C preprocessor |
ExistentialQuantification | existential quantification |
FunctionalPatterns | functional patterns |
NegativeLiterals | negative literals |
NoImplicitPrelude | no implicit import of the prelude |
Different Curry tools which may accept compiler options.
Export specification
data ExportSpec Source #
Export specification
Single exported entity
Import declarations
data ImportDecl Source #
Import declaration
data ImportSpec Source #
Import specification
Single imported entity
Interface
Module interface
Interface declarations are restricted to type declarations and signatures. Note that an interface function declaration additionaly contains the function arity (= number of parameters) in order to generate correct FlatCurry function applications.
data IImportDecl Source #
Interface import declaration
Interface declaration
Kind expressions
data IMethodDecl Source #
Class methods
type IMethodImpl = (Ident, Arity) Source #
Class method implementations
Declarations
Declaration in a module
type Precedence = Integer Source #
Operator precedence
Fixity of operators
data ConstrDecl Source #
Constructor declaration for algebraic data types
data NewConstrDecl Source #
Constructor declaration for renaming types (newtypes)
Declaration for labelled fields
Calling convention for C code
Type expressions
data QualTypeExpr Source #
Qualified type expressions
Function defining equation
Left-hand-side of an Equation
(function identifier and patterns)
Right-hand-side of an Equation
SimpleRhs Position (Expression a) [Decl a] | |
GuardedRhs [CondExpr a] [Decl a] |
Conditional expression (expression conditioned by a guard)
CondExpr Position (Expression a) (Expression a) |
Literal
Constructor term (used for patterns)
LiteralPattern a Literal | |
NegativePattern a Literal | |
VariablePattern a Ident | |
ConstructorPattern a QualIdent [Pattern a] | |
InfixPattern a (Pattern a) QualIdent (Pattern a) | |
ParenPattern (Pattern a) | |
RecordPattern a QualIdent [Field (Pattern a)] | |
TuplePattern [Pattern a] | |
ListPattern a [Pattern a] | |
AsPattern Ident (Pattern a) | |
LazyPattern (Pattern a) | |
FunctionPattern a QualIdent [Pattern a] | |
InfixFuncPattern a (Pattern a) QualIdent (Pattern a) |
data Expression a Source #
Expression
Literal a Literal | |
Variable a QualIdent | |
Constructor a QualIdent | |
Paren (Expression a) | |
Typed (Expression a) QualTypeExpr | |
Record a QualIdent [Field (Expression a)] | |
RecordUpdate (Expression a) [Field (Expression a)] | |
Tuple [Expression a] | |
List a [Expression a] | |
ListCompr (Expression a) [Statement a] | |
EnumFrom (Expression a) | |
EnumFromThen (Expression a) (Expression a) | |
EnumFromTo (Expression a) (Expression a) | |
EnumFromThenTo (Expression a) (Expression a) (Expression a) | |
UnaryMinus (Expression a) | |
Apply (Expression a) (Expression a) | |
InfixApply (Expression a) (InfixOp a) (Expression a) | |
LeftSection (Expression a) (InfixOp a) | |
RightSection (InfixOp a) (Expression a) | |
Lambda [Pattern a] (Expression a) | |
Let [Decl a] (Expression a) | |
Do [Statement a] (Expression a) | |
IfThenElse (Expression a) (Expression a) (Expression a) | |
Case CaseType (Expression a) [Alt a] |
Functor Expression Source # | |
Eq a => Eq (Expression a) Source # | |
Read a => Read (Expression a) Source # | |
Show a => Show (Expression a) Source # | |
Infix operation
Statement (used for do-sequence and list comprehensions)
StmtExpr (Expression a) | |
StmtDecl [Decl a] | |
StmtBind (Pattern a) (Expression a) |
Type of case expressions
Single case alternative
Record field
Annotated identifier
Type classes
type Context = [Constraint] Source #
data Constraint Source #
type InstanceType = TypeExpr Source #