curry-base-0.4.2: Functions for manipulating Curry programs

Copyright(c) 1999 - 2004 Wolfgang Lux 2005 Martin Engelke 2011 - 2014 Björn Peemöller 2015 Jan Tikovsky
LicenseBSD-3-clause
Maintainerbjp@informatik.uni-kiel.de
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Curry.Syntax.Utils

Description

This module provides some utility functions for working with the abstract syntax tree of Curry.

Synopsis

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

isTypeSig :: Decl -> Bool Source #

Is the declaration a type signature?

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

mkInt :: Integer -> Literal Source #

Construct an Integer literal

fieldLabel :: Field a -> QualIdent Source #

Select the label of a field

fieldTerm :: Field a -> a Source #

Select the term of a field

field2Tuple :: Field a -> (QualIdent, a) Source #

Select the label and term of a field

opName :: InfixOp -> QualIdent Source #

Get the operator name of an infix operator

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