Copyright | (c) 1999 - 2004 Wolfgang Lux 2005 Martin Engelke 2011 - 2014 Björn Peemöller 2015 Jan 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 some utility functions for working with the abstract syntax tree of Curry.
Synopsis
- hasLanguageExtension :: Module a -> KnownExtension -> Bool
- knownExtensions :: Module a -> [KnownExtension]
- isTopDecl :: Decl a -> Bool
- isBlockDecl :: Decl a -> Bool
- isTypeSig :: Decl a -> Bool
- infixOp :: InfixOp a -> Expression a
- isTypeDecl :: Decl a -> Bool
- isValueDecl :: Decl a -> Bool
- isInfixDecl :: Decl a -> Bool
- isDefaultDecl :: Decl a -> Bool
- isClassDecl :: Decl a -> Bool
- isTypeOrClassDecl :: Decl a -> Bool
- isInstanceDecl :: Decl a -> Bool
- isFunctionDecl :: Decl a -> Bool
- isExternalDecl :: Decl a -> Bool
- patchModuleId :: FilePath -> Module a -> Module a
- isVariablePattern :: Pattern a -> Bool
- isVariableType :: TypeExpr -> Bool
- isSimpleType :: TypeExpr -> Bool
- typeConstr :: TypeExpr -> QualIdent
- typeVariables :: TypeExpr -> [Ident]
- varIdent :: Var a -> Ident
- flatLhs :: Lhs a -> (Ident, [Pattern a])
- eqnArity :: Equation a -> Int
- fieldLabel :: Field a -> QualIdent
- fieldTerm :: Field a -> a
- field2Tuple :: Field a -> (QualIdent, a)
- opName :: InfixOp a -> QualIdent
- funDecl :: SpanInfo -> a -> Ident -> [Pattern a] -> Expression a -> Decl a
- mkEquation :: SpanInfo -> Ident -> [Pattern a] -> Expression a -> Equation a
- simpleRhs :: SpanInfo -> Expression a -> Rhs a
- patDecl :: SpanInfo -> Pattern a -> Expression a -> Decl a
- varDecl :: SpanInfo -> a -> Ident -> Expression a -> Decl a
- constrPattern :: a -> QualIdent -> [(a, Ident)] -> Pattern a
- caseAlt :: SpanInfo -> Pattern a -> Expression a -> Alt a
- mkLet :: [Decl a] -> Expression a -> Expression a
- mkVar :: a -> Ident -> Expression a
- apply :: Expression a -> [Expression a] -> Expression a
- unapply :: Expression a -> [Expression a] -> (Expression a, [Expression a])
- constrId :: ConstrDecl -> Ident
- nconstrId :: NewConstrDecl -> Ident
- nconstrType :: NewConstrDecl -> TypeExpr
- recordLabels :: ConstrDecl -> [Ident]
- nrecordLabels :: NewConstrDecl -> [Ident]
- methods :: Decl a -> [Ident]
- impls :: Decl a -> [Ident]
- imethod :: IMethodDecl -> Ident
- imethodArity :: IMethodDecl -> Maybe Int
- shortenModuleAST :: Module () -> Module ()
Documentation
hasLanguageExtension :: Module a -> KnownExtension -> Bool Source #
knownExtensions :: Module a -> [KnownExtension] Source #
Extract all known extensions from a Module
isBlockDecl :: Decl a -> Bool Source #
Is the declaration a block declaration?
infixOp :: InfixOp a -> Expression a Source #
Convert an infix operator into an expression
isTypeDecl :: Decl a -> Bool Source #
Is the declaration a type declaration?
isValueDecl :: Decl a -> Bool Source #
Is the declaration a value declaration?
isInfixDecl :: Decl a -> Bool Source #
Is the declaration an infix declaration?
isDefaultDecl :: Decl a -> Bool Source #
Is the declaration a default declaration?
isClassDecl :: Decl a -> Bool Source #
Is the declaration a class declaration?
isTypeOrClassDecl :: Decl a -> Bool Source #
Is the declaration a type or a class declaration?
isInstanceDecl :: Decl a -> Bool Source #
Is the declaration an instance declaration?
isFunctionDecl :: Decl a -> Bool Source #
Is the declaration a function declaration?
isExternalDecl :: Decl a -> Bool Source #
Is the declaration an external declaration?
patchModuleId :: FilePath -> Module a -> Module a Source #
Replace the generic module name main
with the module name derived
from the FilePath
of the module.
isVariablePattern :: Pattern a -> Bool Source #
Is the pattern semantically equivalent to a variable pattern?
isVariableType :: TypeExpr -> Bool Source #
Is a type expression a type variable?
isSimpleType :: TypeExpr -> Bool Source #
Is a type expression simple, i.e., is it of the form T u_1 ... u_n, where T is a type constructor and u_1 ... u_n are type variables?
typeConstr :: TypeExpr -> QualIdent Source #
Return the qualified type constructor of a type expression.
typeVariables :: TypeExpr -> [Ident] Source #
Return the list of variables occuring in a type expression.
flatLhs :: Lhs a -> (Ident, [Pattern a]) Source #
flatten the left-hand-side to the identifier and all constructor terms
fieldLabel :: Field a -> QualIdent Source #
Select the label of a field
field2Tuple :: Field a -> (QualIdent, a) Source #
Select the label and term of a field
mkEquation :: SpanInfo -> Ident -> [Pattern a] -> Expression a -> Equation a Source #
mkLet :: [Decl a] -> Expression a -> Expression a Source #
mkVar :: a -> Ident -> Expression a Source #
apply :: Expression a -> [Expression a] -> Expression a Source #
unapply :: Expression a -> [Expression a] -> (Expression a, [Expression a]) Source #
constrId :: ConstrDecl -> Ident Source #
Get the identifier of a constructor declaration
nconstrId :: NewConstrDecl -> Ident Source #
Get the identifier of a newtype constructor declaration
nconstrType :: NewConstrDecl -> TypeExpr Source #
Get the type of a newtype constructor declaration
recordLabels :: ConstrDecl -> [Ident] Source #
Get record label identifiers of a constructor declaration
nrecordLabels :: NewConstrDecl -> [Ident] Source #
Get record label identifier of a newtype constructor declaration
methods :: Decl a -> [Ident] Source #
Get the declared method identifiers of a type class method declaration
impls :: Decl a -> [Ident] Source #
Get the method identifiers of a type class method implementations
imethod :: IMethodDecl -> Ident Source #
Get the declared method identifier of an interface method declaration
imethodArity :: IMethodDecl -> Maybe Int Source #
Get the arity of an interface method declaration
shortenModuleAST :: Module () -> Module () Source #