Module Rewriting.Files

Library to read and transform a curry program into an equivalent representation, where every function gets assigned the corresponding term rewriting system and every type has a corresponding type declaration.

Author: Jan-Hendrik Matthes

Version: October 2016

Summary of exported operations:

showQName :: (String,String) -> String   
Transforms a qualified name into a string representation.
readQName :: String -> (String,String)   
Transforms a string into a qualified name.
condQName :: (String,String)   
Returns the qualified name for an if-then-else-constructor.
condTRS :: [(Term (String,String),Term (String,String))]   
Returns the term rewriting system for an if-then-else-function.
readCurryProgram :: String -> IO (Either String (FM (String,String) [(Term (String,String),Term (String,String))],[CTypeDecl]))   
Tries to read and transform a curry program into an equivalent representation, where every function gets assigned the corresponding term rewriting system and every type has a corresponding type declaration.
fromCurryProg :: CurryProg -> (FM (String,String) [(Term (String,String),Term (String,String))],[CTypeDecl])   
Transforms an abstract curry program into an equivalent representation, where every function gets assigned the corresponding term rewriting system and every type has a corresponding type declaration.
fromFuncDecl :: CFuncDecl -> ((String,String),[(Term (String,String),Term (String,String))])   
Transforms an abstract curry function declaration into a pair with function name and corresponding term rewriting system.
fromRule :: (String,String) -> CRule -> ((Term (String,String),Term (String,String)),[(Term (String,String),Term (String,String))])   
Transforms an abstract curry rule for the function with the given name into a pair of a rule and a term rewriting system.
fromLiteral :: CLiteral -> Term (String,String)   
Transforms an abstract curry literal into a term.
fromPattern :: (String,String) -> CPattern -> (Term (String,String),FM Int (Term (String,String)))   
Transforms an abstract curry pattern for the function with the given name into a pair of a term and a substitution.
fromRhs :: (String,String) -> CRhs -> (Term (String,String),FM Int (Term (String,String)),[(Term (String,String),Term (String,String))])   
Transforms an abstract curry right-hand side of a rule for the function with the given name into a tuple of a term, a substitution and a term rewriting system.
fromExpr :: (String,String) -> CExpr -> (Term (String,String),FM Int (Term (String,String)),[(Term (String,String),Term (String,String))])   
Transforms an abstract curry expression for the function with the given name into a tuple of a term, a substitution and a term rewriting system.

Exported datatypes:


TRSData

Mappings from a function name to the corresponding term rewriting system represented as a finite map from qualified names to term rewriting systems.

Type synonym: TRSData = FM QName (TRS QName)


TypeData

Information about types represented as a list of type declarations.

Type synonym: TypeData = [CTypeDecl]


RWData

Representation of term rewriting system data and type data as a pair.

Type synonym: RWData = (TRSData,TypeData)


Exported operations:

showQName :: (String,String) -> String   

Transforms a qualified name into a string representation.

readQName :: String -> (String,String)   

Transforms a string into a qualified name.

condQName :: (String,String)   

Returns the qualified name for an if-then-else-constructor.

Further infos:
  • solution complete, i.e., able to compute all solutions

condTRS :: [(Term (String,String),Term (String,String))]   

Returns the term rewriting system for an if-then-else-function.

Further infos:
  • solution complete, i.e., able to compute all solutions

readCurryProgram :: String -> IO (Either String (FM (String,String) [(Term (String,String),Term (String,String))],[CTypeDecl]))   

Tries to read and transform a curry program into an equivalent representation, where every function gets assigned the corresponding term rewriting system and every type has a corresponding type declaration.

fromCurryProg :: CurryProg -> (FM (String,String) [(Term (String,String),Term (String,String))],[CTypeDecl])   

Transforms an abstract curry program into an equivalent representation, where every function gets assigned the corresponding term rewriting system and every type has a corresponding type declaration.

fromFuncDecl :: CFuncDecl -> ((String,String),[(Term (String,String),Term (String,String))])   

Transforms an abstract curry function declaration into a pair with function name and corresponding term rewriting system.

fromRule :: (String,String) -> CRule -> ((Term (String,String),Term (String,String)),[(Term (String,String),Term (String,String))])   

Transforms an abstract curry rule for the function with the given name into a pair of a rule and a term rewriting system.

fromLiteral :: CLiteral -> Term (String,String)   

Transforms an abstract curry literal into a term.

fromPattern :: (String,String) -> CPattern -> (Term (String,String),FM Int (Term (String,String)))   

Transforms an abstract curry pattern for the function with the given name into a pair of a term and a substitution.

fromRhs :: (String,String) -> CRhs -> (Term (String,String),FM Int (Term (String,String)),[(Term (String,String),Term (String,String))])   

Transforms an abstract curry right-hand side of a rule for the function with the given name into a tuple of a term, a substitution and a term rewriting system.

fromExpr :: (String,String) -> CExpr -> (Term (String,String),FM Int (Term (String,String)),[(Term (String,String),Term (String,String))])   

Transforms an abstract curry expression for the function with the given name into a tuple of a term, a substitution and a term rewriting system.