Copyright | (c) 1999 - 2004 Wolfgang Lux 2005 Martin Engelke 2011 - 2014 Björn Peemöller 2015 Jan Tikovsky |
---|---|
License | BSD-3-clause |
Maintainer | bjp@informatik.uni-kiel.de |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Curry.Syntax.Utils
Description
This module provides some utility functions for working with the abstract syntax tree of Curry.
- hasLanguageExtension :: Module -> KnownExtension -> Bool
- knownExtensions :: Module -> [KnownExtension]
- isTypeSig :: Decl -> Bool
- infixOp :: InfixOp -> Expression
- isTypeDecl :: Decl -> Bool
- isValueDecl :: Decl -> Bool
- isInfixDecl :: Decl -> Bool
- isFunctionDecl :: Decl -> Bool
- isExternalDecl :: Decl -> Bool
- patchModuleId :: FilePath -> Module -> Module
- flatLhs :: Lhs -> (Ident, [Pattern])
- mkInt :: Integer -> Literal
- fieldLabel :: Field a -> QualIdent
- fieldTerm :: Field a -> a
- field2Tuple :: Field a -> (QualIdent, a)
- opName :: InfixOp -> QualIdent
- addSrcRefs :: Module -> Module
- constrId :: ConstrDecl -> Ident
- nconstrId :: NewConstrDecl -> Ident
- recordLabels :: ConstrDecl -> [Ident]
- nrecordLabels :: NewConstrDecl -> [Ident]
Documentation
hasLanguageExtension :: Module -> KnownExtension -> Bool Source #
Check whether a Module
has a specific KnownExtension
enabled by a pragma
knownExtensions :: Module -> [KnownExtension] Source #
Extract all known extensions from a Module
infixOp :: InfixOp -> Expression Source #
Convert an infix operator into an expression
isTypeDecl :: Decl -> Bool Source #
Is the declaration a type declaration?
isValueDecl :: Decl -> Bool Source #
Is the declaration a value declaration?
isInfixDecl :: Decl -> Bool Source #
Is the declaration an infix declaration?
isFunctionDecl :: Decl -> Bool Source #
Is the declaration a function declaration?
isExternalDecl :: Decl -> Bool Source #
Is the declaration an external declaration?
patchModuleId :: FilePath -> Module -> Module Source #
Replace the generic module name main
with the module name derived
from the FilePath
of the module.
flatLhs :: Lhs -> (Ident, [Pattern]) 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
constrId :: ConstrDecl -> Ident Source #
Get the identifier of a constructor declaration
nconstrId :: NewConstrDecl -> Ident Source #
Get the identifier 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