Copyright | (c) 1999 - 2004 Wolfgang Lux 2005 Martin Engelke 2011 - 2015 Björn Peemöller 2014 Jan Rasmus Tikovsky |
---|---|
License | BSD-3-clause |
Maintainer | bjp@informatik.uni-kiel.de |
Stability | experimental |
Portability | non-portable (DeriveDataTypeable) |
Safe Haskell | None |
Language | Haskell2010 |
Curry.Syntax.Type
Contents
Description
This module provides the necessary data structures to maintain the parsed representation of a Curry pProgram.
- data Module = Module [ModulePragma] ModuleIdent (Maybe ExportSpec) [ImportDecl] [Decl]
- data ModulePragma
- data Extension
- data KnownExtension
- data Tool
- = KICS2
- | PAKCS
- | CYMAKE
- | UnknownTool String
- 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 [Ident]
- | IDataDecl Position QualIdent [Ident] [ConstrDecl] [Ident]
- | INewtypeDecl Position QualIdent [Ident] NewConstrDecl [Ident]
- | ITypeDecl Position QualIdent [Ident] TypeExpr
- | IFunctionDecl Position QualIdent Arity TypeExpr
- data Decl
- = InfixDecl Position Infix (Maybe Precedence) [Ident]
- | DataDecl Position Ident [Ident] [ConstrDecl]
- | NewtypeDecl Position Ident [Ident] NewConstrDecl
- | TypeDecl Position Ident [Ident] TypeExpr
- | TypeSig Position [Ident] TypeExpr
- | FunctionDecl Position Ident [Equation]
- | ForeignDecl Position CallConv (Maybe String) Ident TypeExpr
- | ExternalDecl Position [Ident]
- | PatternDecl Position Pattern Rhs
- | FreeDecl Position [Ident]
- type Precedence = Integer
- data Infix
- data ConstrDecl
- data NewConstrDecl
- data FieldDecl = FieldDecl Position [Ident] TypeExpr
- data CallConv
- data TypeExpr
- data Equation = Equation Position Lhs Rhs
- data Lhs
- data Rhs
- = SimpleRhs Position Expression [Decl]
- | GuardedRhs [CondExpr] [Decl]
- data CondExpr = CondExpr Position Expression Expression
- data Literal
- data Pattern
- = LiteralPattern Literal
- | NegativePattern Ident Literal
- | VariablePattern Ident
- | ConstructorPattern QualIdent [Pattern]
- | InfixPattern Pattern QualIdent Pattern
- | ParenPattern Pattern
- | RecordPattern QualIdent [Field Pattern]
- | TuplePattern SrcRef [Pattern]
- | ListPattern [SrcRef] [Pattern]
- | AsPattern Ident Pattern
- | LazyPattern SrcRef Pattern
- | FunctionPattern QualIdent [Pattern]
- | InfixFuncPattern Pattern QualIdent Pattern
- data Expression
- = Literal Literal
- | Variable QualIdent
- | Constructor QualIdent
- | Paren Expression
- | Typed Expression TypeExpr
- | Record QualIdent [Field Expression]
- | RecordUpdate Expression [Field Expression]
- | Tuple SrcRef [Expression]
- | List [SrcRef] [Expression]
- | ListCompr SrcRef Expression [Statement]
- | EnumFrom Expression
- | EnumFromThen Expression Expression
- | EnumFromTo Expression Expression
- | EnumFromThenTo Expression Expression Expression
- | UnaryMinus Ident Expression
- | Apply Expression Expression
- | InfixApply Expression InfixOp Expression
- | LeftSection Expression InfixOp
- | RightSection InfixOp Expression
- | Lambda SrcRef [Pattern] Expression
- | Let [Decl] Expression
- | Do [Statement] Expression
- | IfThenElse SrcRef Expression Expression Expression
- | Case SrcRef CaseType Expression [Alt]
- data InfixOp
- data Statement
- data CaseType
- data Alt = Alt Position Pattern Rhs
- data Field a = Field Position QualIdent a
- data Goal = Goal Position Expression [Decl]
Module header
Curry module
Constructors
Module [ModulePragma] ModuleIdent (Maybe ExportSpec) [ImportDecl] [Decl] |
Module pragmas
data ModulePragma Source #
Module pragma
Constructors
LanguagePragma Position [Extension] | language pragma |
OptionsPragma Position (Maybe Tool) String | options pragma |
Instances
Specified language extensions, either known or unknown.
Constructors
KnownExtension Position KnownExtension | a known extension |
UnknownExtension Position String | an unknown extension |
data KnownExtension Source #
Known language extensions of Curry.
Constructors
AnonFreeVars | anonymous free variables |
FunctionalPatterns | functional patterns |
NegativeLiterals | negative literals |
NoImplicitPrelude | no implicit import of the prelude |
Different Curry tools which may accept compiler options.
Constructors
KICS2 | |
PAKCS | |
CYMAKE | |
UnknownTool String |
Export specification
Single exported entity
Constructors
Export QualIdent | |
ExportTypeWith QualIdent [Ident] | |
ExportTypeAll QualIdent | |
ExportModule ModuleIdent |
Import declarations
data ImportDecl Source #
Import declaration
Constructors
ImportDecl Position ModuleIdent Qualified (Maybe ModuleIdent) (Maybe ImportSpec) |
Instances
Single imported entity
Constructors
Import Ident | |
ImportTypeWith Ident [Ident] | |
ImportTypeAll Ident |
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.
Constructors
Interface ModuleIdent [IImportDecl] [IDecl] |
data IImportDecl Source #
Interface import declaration
Constructors
IImportDecl Position ModuleIdent |
Instances
Interface declaration
Constructors
Declarations
Declaration in a module
Constructors
type Precedence = Integer Source #
Operator precedence
Fixity of operators
data ConstrDecl Source #
Constructor declaration for algebraic data types
Constructors
ConstrDecl Position [Ident] Ident [TypeExpr] | |
ConOpDecl Position [Ident] TypeExpr Ident TypeExpr | |
RecordDecl Position [Ident] Ident [FieldDecl] |
Instances
data NewConstrDecl Source #
Constructor declaration for renaming types (newtypes)
Constructors
NewConstrDecl Position [Ident] Ident TypeExpr | |
NewRecordDecl Position [Ident] Ident (Ident, TypeExpr) |
Instances
Declaration for labelled fields
Calling convention for C code
Constructors
CallConvPrimitive | |
CallConvCCall |
Type expressions
Function defining equation
Left-hand-side of an Equation
(function identifier and patterns)
Right-hand-side of an Equation
Constructors
SimpleRhs Position Expression [Decl] | |
GuardedRhs [CondExpr] [Decl] |
Conditional expression (expression conditioned by a guard)
Constructors
CondExpr Position Expression Expression |
Literal
The Ident
argument of an Int
literal is used for supporting ad-hoc
polymorphism on integer numbers. An integer literal can be used either as
an integer number or as a floating-point number depending on its context.
The compiler uses the identifier of the Int
literal for maintaining its
type.
Constructor term (used for patterns)
Constructors
data Expression Source #
Expression
Constructors
Instances
Infix operation
Constructors
InfixOp QualIdent | |
InfixConstr QualIdent |
Statement (used for do-sequence and list comprehensions)
Constructors
StmtExpr SrcRef Expression | |
StmtDecl [Decl] | |
StmtBind SrcRef Pattern Expression |
Type of case expressions
Single case alternative
Record field