This library provides transformation and update operations
on AbstractCurry programs.
Since the transformations are defined recursively on structured types,
they are useful to construct specific transformations on AbstractCurry
programs.
In particular, this library contains the transformation
renameCurryModule
to rename an AbstractCurry module.
Author: Michael Hanus
Version: April 2016
trCProg
:: (String -> [String] -> [CTypeDecl] -> [CFuncDecl] -> [COpDecl] -> a) -> CurryProg -> a
Transforms an AbstractCurry program. |
trCTypeDecl
:: ((((Int,Int),(Int,Int)),String,String) -> CVisibility -> [(((Int,Int),(Int,Int)),Int,String)] -> [CConsDecl] -> a) -> ((((Int,Int),(Int,Int)),String,String) -> CVisibility -> [(((Int,Int),(Int,Int)),Int,String)] -> CTypeExpr -> a) -> ((((Int,Int),(Int,Int)),String,String) -> CVisibility -> [(((Int,Int),(Int,Int)),Int,String)] -> CConsDecl -> a) -> CTypeDecl -> a
Transforms a type declaration. |
trCConsDecl
:: ((((Int,Int),(Int,Int)),String,String) -> CVisibility -> [CTypeExpr] -> a) -> ((((Int,Int),(Int,Int)),String,String) -> CVisibility -> [CFieldDecl] -> a) -> CConsDecl -> a
Transforms a constructor declaration. |
trCFieldDecl
:: ((((Int,Int),(Int,Int)),String,String) -> CVisibility -> CTypeExpr -> a) -> CFieldDecl -> a
Transforms a constructor declaration. |
trCTypeExpr
:: ((((Int,Int),(Int,Int)),Int,String) -> a) -> ((((Int,Int),(Int,Int)),String,String) -> [a] -> a) -> (a -> a -> a) -> CTypeExpr -> a
Transforms a type expression. |
trCOpDecl
:: ((((Int,Int),(Int,Int)),String,String) -> CFixity -> Int -> a) -> COpDecl -> a
Transforms an operator declaration. |
trCFuncDecl
:: (String -> (((Int,Int),(Int,Int)),String,String) -> Int -> CVisibility -> CTypeExpr -> [CRule] -> a) -> CFuncDecl -> a
Transforms a function declaration |
trCRule
:: ([CPattern] -> CRhs -> a) -> CRule -> a
Transform a rule. |
trCRhs
:: (CExpr -> [CLocalDecl] -> a) -> ([(((Int,Int),(Int,Int)),CExpr,CExpr)] -> [CLocalDecl] -> a) -> CRhs -> a
Transforms a right-hand side (of a rule or case expression). |
trCLocalDecl
:: (CFuncDecl -> a) -> (CPattern -> CRhs -> a) -> ([(((Int,Int),(Int,Int)),Int,String)] -> a) -> CLocalDecl -> a
Transforms a local declaration. |
trCPattern
:: ((((Int,Int),(Int,Int)),Int,String) -> a) -> (CLiteral -> a) -> ((((Int,Int),(Int,Int)),String,String) -> [a] -> a) -> ((((Int,Int),(Int,Int)),Int,String) -> a -> a) -> ((((Int,Int),(Int,Int)),String,String) -> [a] -> a) -> ((((Int,Int),(Int,Int)),String,String) -> [((((Int,Int),(Int,Int)),String,String),a)] -> a) -> CPattern -> a
Transforms a pattern. |
trExpr
:: ((((Int,Int),(Int,Int)),Int,String) -> a) -> (CLiteral -> a) -> ((((Int,Int),(Int,Int)),String,String) -> a) -> (a -> a -> a) -> ([CPattern] -> a -> a) -> ([CLocalDecl] -> a -> a) -> ([CStatement] -> a) -> (a -> [CStatement] -> a) -> (CCaseType -> a -> [(CPattern,CRhs)] -> a) -> (a -> CTypeExpr -> a) -> ((((Int,Int),(Int,Int)),String,String) -> [((((Int,Int),(Int,Int)),String,String),a)] -> a) -> (a -> [((((Int,Int),(Int,Int)),String,String),a)] -> a) -> CExpr -> a
Transforms an expression. |
trCStatement
:: (CExpr -> a) -> (CPattern -> CExpr -> a) -> ([CLocalDecl] -> a) -> CStatement -> a
Transforms a statement (occuring in do expressions or list comprehensions). |
typesOfCurryProg
:: CurryProg -> [(((Int,Int),(Int,Int)),String,String)]
Extracts all type names occurring in a program. |
typesOfCTypeDecl
:: CTypeDecl -> [(((Int,Int),(Int,Int)),String,String)]
Extracts all type names occurring in a type declaration. |
typesOfConsDecl
:: CConsDecl -> [(((Int,Int),(Int,Int)),String,String)]
|
typesOfFieldDecl
:: CFieldDecl -> [(((Int,Int),(Int,Int)),String,String)]
|
typesOfTypeExpr
:: CTypeExpr -> [(((Int,Int),(Int,Int)),String,String)]
|
typesOfCFuncDecl
:: CFuncDecl -> [(((Int,Int),(Int,Int)),String,String)]
|
funcsOfCurryProg
:: CurryProg -> [(((Int,Int),(Int,Int)),String,String)]
Extracts all function (and constructor) names occurring in a program. |
funcsOfCTypeDecl
:: CTypeDecl -> [(((Int,Int),(Int,Int)),String,String)]
|
funcsOfConsDecl
:: CConsDecl -> [(((Int,Int),(Int,Int)),String,String)]
|
funcsOfFieldDecl
:: CFieldDecl -> [(((Int,Int),(Int,Int)),String,String)]
|
funcsOfCFuncDecl
:: CFuncDecl -> [(((Int,Int),(Int,Int)),String,String)]
Extracts all function (and constructor) names occurring in a function declaration. |
funcsOfCRule
:: CRule -> [(((Int,Int),(Int,Int)),String,String)]
|
funcsOfCRhs
:: CRhs -> [(((Int,Int),(Int,Int)),String,String)]
|
funcsOfLDecl
:: CLocalDecl -> [(((Int,Int),(Int,Int)),String,String)]
|
funcsOfExpr
:: CExpr -> [(((Int,Int),(Int,Int)),String,String)]
|
funcsOfStat
:: CStatement -> [(((Int,Int),(Int,Int)),String,String)]
|
renameCurryModule
:: String -> CurryProg -> CurryProg
|
updCProg
:: (String -> String) -> ([String] -> [String]) -> ([CTypeDecl] -> [CTypeDecl]) -> ([CFuncDecl] -> [CFuncDecl]) -> ([COpDecl] -> [COpDecl]) -> CurryProg -> CurryProg
Updates an AbstractCurry program. |
updCProgName
:: (String -> String) -> CurryProg -> CurryProg
|
updCTypeDecl
:: ((((Int,Int),(Int,Int)),String,String) -> (((Int,Int),(Int,Int)),String,String)) -> (CVisibility -> CVisibility) -> ([(((Int,Int),(Int,Int)),Int,String)] -> [(((Int,Int),(Int,Int)),Int,String)]) -> ([CConsDecl] -> [CConsDecl]) -> (CTypeExpr -> CTypeExpr) -> (CConsDecl -> CConsDecl) -> CTypeDecl -> CTypeDecl
update type declaration |
getPosType
:: CTypeDecl -> ((Int,Int),(Int,Int))
|
updCTypeDeclName
:: ((((Int,Int),(Int,Int)),String,String) -> (((Int,Int),(Int,Int)),String,String)) -> CTypeDecl -> CTypeDecl
Updates the name of a type declaration. |
updCConsDecl
:: ((((Int,Int),(Int,Int)),String,String) -> (((Int,Int),(Int,Int)),String,String)) -> (CVisibility -> CVisibility) -> ([CTypeExpr] -> [CTypeExpr]) -> ([CFieldDecl] -> [CFieldDecl]) -> CConsDecl -> CConsDecl
Updates a constructor declaration. |
getPosCons
:: CConsDecl -> ((Int,Int),(Int,Int))
|
updCConsDeclName
:: ((((Int,Int),(Int,Int)),String,String) -> (((Int,Int),(Int,Int)),String,String)) -> CConsDecl -> CConsDecl
Updates the name of a constructor declaration. |
updCFieldDecl
:: ((((Int,Int),(Int,Int)),String,String) -> (((Int,Int),(Int,Int)),String,String)) -> (CVisibility -> CVisibility) -> (CTypeExpr -> CTypeExpr) -> CFieldDecl -> CFieldDecl
update constructor declaration |
updCFieldDeclName
:: ((((Int,Int),(Int,Int)),String,String) -> (((Int,Int),(Int,Int)),String,String)) -> CFieldDecl -> CFieldDecl
Updates the name of a constructor declaration. |
updTConsApp
:: ((((Int,Int),(Int,Int)),String,String) -> [CTypeExpr] -> CTypeExpr) -> CTypeExpr -> CTypeExpr
Updates all type constructor applications in a type expression. |
updCOpDecl
:: ((((Int,Int),(Int,Int)),String,String) -> (((Int,Int),(Int,Int)),String,String)) -> (CFixity -> CFixity) -> (Int -> Int) -> COpDecl -> COpDecl
Updates an operator declaration. |
updCOpName
:: ((((Int,Int),(Int,Int)),String,String) -> (((Int,Int),(Int,Int)),String,String)) -> COpDecl -> COpDecl
Updates the name of an operator declaration. |
updCFuncDecl
:: (String -> String) -> ((((Int,Int),(Int,Int)),String,String) -> (((Int,Int),(Int,Int)),String,String)) -> (Int -> Int) -> (CVisibility -> CVisibility) -> (CTypeExpr -> CTypeExpr) -> ([CRule] -> [CRule]) -> CFuncDecl -> CFuncDecl
Updates a function declaration. |
getPosFunc
:: CFuncDecl -> Maybe ((Int,Int),(Int,Int))
|
updCRule
:: ([CPattern] -> [CPattern]) -> (CRhs -> CRhs) -> CRule -> CRule
Update a rule. |
updCRhs
:: (CExpr -> CExpr) -> ([(((Int,Int),(Int,Int)),CExpr,CExpr)] -> [(((Int,Int),(Int,Int)),CExpr,CExpr)]) -> ([CLocalDecl] -> [CLocalDecl]) -> CRhs -> CRhs
Updates right-hand side. |
updCLocalDecl
:: (CFuncDecl -> CFuncDecl) -> (CPattern -> CPattern) -> (CRhs -> CRhs) -> ([(((Int,Int),(Int,Int)),Int,String)] -> [(((Int,Int),(Int,Int)),Int,String)]) -> CLocalDecl -> CLocalDecl
Updates a local declaration. |
getPos
:: CLocalDecl -> ((Int,Int),(Int,Int))
|
updCPattern
:: ((((Int,Int),(Int,Int)),Int,String) -> (((Int,Int),(Int,Int)),Int,String)) -> (CLiteral -> CLiteral) -> ((((Int,Int),(Int,Int)),String,String) -> (((Int,Int),(Int,Int)),String,String)) -> CPattern -> CPattern
Updates a pattern. |
getPosPat
:: CPattern -> ((Int,Int),(Int,Int))
|
updCStatement
:: (CExpr -> CExpr) -> (CPattern -> CPattern) -> (CLocalDecl -> CLocalDecl) -> CStatement -> CStatement
Updates a statement (occuring in do expressions or list comprehensions). |
getPosStat
:: CStatement -> ((Int,Int),(Int,Int))
|
updQNamesInCProg
:: ((((Int,Int),(Int,Int)),String,String) -> (((Int,Int),(Int,Int)),String,String)) -> CurryProg -> CurryProg
Updates all qualified names in a Curry program. |
updQNamesInCTypeDecl
:: ((((Int,Int),(Int,Int)),String,String) -> (((Int,Int),(Int,Int)),String,String)) -> CTypeDecl -> CTypeDecl
Updates all qualified names in a type declaration. |
updQNamesInCConsDecl
:: ((((Int,Int),(Int,Int)),String,String) -> (((Int,Int),(Int,Int)),String,String)) -> CConsDecl -> CConsDecl
Updates all qualified names in a constructor declaration. |
updQNamesInCFieldDecl
:: ((((Int,Int),(Int,Int)),String,String) -> (((Int,Int),(Int,Int)),String,String)) -> CFieldDecl -> CFieldDecl
Updates all qualified names in a record field declaration. |
updQNamesInCTypeExpr
:: ((((Int,Int),(Int,Int)),String,String) -> (((Int,Int),(Int,Int)),String,String)) -> CTypeExpr -> CTypeExpr
Updates all qualified names in a type expression. |
updQNamesInCFuncDecl
:: ((((Int,Int),(Int,Int)),String,String) -> (((Int,Int),(Int,Int)),String,String)) -> CFuncDecl -> CFuncDecl
Updates all qualified names in a function declaration. |
updQNamesInCRule
:: ((((Int,Int),(Int,Int)),String,String) -> (((Int,Int),(Int,Int)),String,String)) -> CRule -> CRule
Updates all qualified names in a function declaration. |
updQNamesInCRhs
:: ((((Int,Int),(Int,Int)),String,String) -> (((Int,Int),(Int,Int)),String,String)) -> CRhs -> CRhs
Updates all qualified names in a function declaration. |
updQNamesInCLocalDecl
:: ((((Int,Int),(Int,Int)),String,String) -> (((Int,Int),(Int,Int)),String,String)) -> CLocalDecl -> CLocalDecl
Updates all qualified names in a function declaration. |
updQNamesInCPattern
:: ((((Int,Int),(Int,Int)),String,String) -> (((Int,Int),(Int,Int)),String,String)) -> CPattern -> CPattern
Updates all qualified names in a function declaration. |
updQNamesInCStatement
:: ((((Int,Int),(Int,Int)),String,String) -> (((Int,Int),(Int,Int)),String,String)) -> CStatement -> CStatement
Updates all qualified names in a statement. |
vir
:: ((Int,Int),(Int,Int))
|
updQNamesInCExpr
:: ((((Int,Int),(Int,Int)),String,String) -> (((Int,Int),(Int,Int)),String,String)) -> CExpr -> CExpr
|
getPosExp
:: CExpr -> ((Int,Int),(Int,Int))
|
Renames a Curry module, i.e., updates the module name and all qualified names in a program.
Type synonym: Update a b = (b -> b) -> a -> a
Transforms an AbstractCurry program. |
Transforms a type declaration. |
Transforms a constructor declaration. |
Transforms a constructor declaration. |
Transforms a type expression. |
Transforms an operator declaration. |
Transforms a function declaration |
Transforms a right-hand side (of a rule or case expression). |
Transforms a local declaration. |
Transforms a pattern. |
Transforms an expression. |
Transforms a statement (occuring in do expressions or list comprehensions). |
Extracts all type names occurring in a program. |
Extracts all type names occurring in a type declaration. |
|
|
|
|
Extracts all function (and constructor) names occurring in a program. |
|
|
|
Extracts all function (and constructor) names occurring in a function declaration. |
|
|
|
|
|
|
Updates an AbstractCurry program. |
|
update type declaration |
|
Updates the name of a type declaration. |
Updates a constructor declaration. |
|
Updates the name of a constructor declaration. |
update constructor declaration |
Updates the name of a constructor declaration. |
Updates all type constructor applications in a type expression. |
Updates an operator declaration. |
Updates the name of an operator declaration. |
Updates a function declaration. |
|
Updates right-hand side. |
Updates a local declaration. |
|
Updates a pattern. |
|
Updates a statement (occuring in do expressions or list comprehensions). |
|
Updates all qualified names in a Curry program. |
Updates all qualified names in a type declaration. |
Updates all qualified names in a constructor declaration. |
Updates all qualified names in a record field declaration. |
Updates all qualified names in a type expression. |
Updates all qualified names in a function declaration. |
Updates all qualified names in a function declaration. |
Updates all qualified names in a function declaration. |
Updates all qualified names in a function declaration. |
Updates all qualified names in a function declaration. |
Updates all qualified names in a statement. |
|
|