Module Data2Xml

A generator for XML data conversion.

If this program is applied to some Curry module, it generates a new Curry module containing conversion functions from and to an XML representation for all data types declared in this module.

For instance, if Nat is a module containing the declaration

data Nat = Z | S Nat

applying this program to Nat generates a new module NatDataToXml containing the implementation of the following operations:

natToXml :: Nat -> XmlExp
xmlToNat :: XmlExp -> Nat

Hence, one can store a Nat term num into the file Nat.xml by

writeXmlFile "Nat.xml" (natToXml num)

provided that the module XML is imported. Similarly, one can read the data from this file by

readXmlFile "Nat.xml" >>= return . xmlToNat

Author: Bernd Brassel, Michael Hanus

Version: December 2020

Summary of exported operations:

main :: IO ()  Non-deterministic 
printUsage :: IO ()  Deterministic 
argsToOptions :: [String] -> [Option]  Deterministic 
outDirOf :: [Option] -> String  Deterministic 
derive :: [Option] -> IO ()  Non-deterministic 
maybeString :: [(String,String)] -> [(String,String)]  Deterministic 
transModName :: String -> String  Deterministic 
toXmlName :: (String,String) -> (String,String)  Deterministic 
fromXmlName :: (String,String) -> (String,String)  Deterministic 
listTag :: [Option] -> String  Deterministic 
isTupleName :: String -> Bool  Deterministic 
tag :: [Option] -> String -> String  Deterministic 
tagNameForCons :: (String,String) -> String  Deterministic 
mkType2Xml :: [Option] -> CTypeDecl -> CFuncDecl  Deterministic 
mkConsDecl2Xml :: [Option] -> [CPattern] -> CConsDecl -> CRule  Deterministic 
type2XmlType :: [(Int,String)] -> CTypeExpr -> CTypeExpr  Deterministic 
call2xml :: (CTypeExpr,Int) -> CExpr  Deterministic 
call2xmlType :: CTypeExpr -> CExpr  Deterministic 
xml :: [Option] -> String -> [CExpr] -> [CExpr] -> CExpr  Deterministic 
xmlType :: CTypeExpr  Deterministic 
mkXml2Type :: [Option] -> CTypeDecl -> CFuncDecl  Deterministic 
renVar :: (a,String) -> (a,String)  Deterministic 
xml2typeType :: [(Int,String)] -> CTypeExpr -> CTypeExpr  Deterministic 
mkXml2ConsDecl :: [Option] -> [CPattern] -> CConsDecl -> CRule  Deterministic 
renameUnused :: [(Int,String)] -> [CPattern] -> [CPattern]  Deterministic 
pxml :: [Option] -> String -> [CPattern] -> [CPattern] -> CPattern  Deterministic 
callXml2 :: (CTypeExpr,Int) -> CExpr  Deterministic 
callXml2Type :: CTypeExpr -> CExpr  Deterministic 
importTypes :: String -> [(String,String)] -> IO [String]  Deterministic 
imessage :: [String] -> IO ()  Deterministic 
importType :: (String,String) -> String  Deterministic 
specialNames :: [String]  Deterministic 
filterSpecials :: [CTypeDecl] -> [CTypeDecl]  Deterministic 
specialFuncs :: [Option] -> [CFuncDecl]  Deterministic 
mkTupleType :: Int -> CTypeDecl  Deterministic 
mkList2xml :: [Option] -> CFuncDecl  Deterministic 
mkXml2List :: [Option] -> CFuncDecl  Deterministic 
baseType2xml :: [Option] -> String -> CFuncDecl  Deterministic 
baseTypeXml2 :: [Option] -> String -> CFuncDecl  Deterministic 
readFun :: String -> CExpr  Deterministic 
writeFun :: String -> CExpr  Deterministic 
requiredTypesTypeDecl :: CTypeDecl -> [(String,String)]  Deterministic 
yield list of all types the given type depends on
requiredTypesConsDecl :: CConsDecl -> [(String,String)]  Deterministic 
requiredTypesTypeExpr :: CTypeExpr -> [(String,String)]  Deterministic 

Exported datatypes:


Option

Constructors:

  • LowCase :: Option
  • FileName :: String -> Option
  • OutDir :: String -> Option

Exported operations:

main :: IO ()  Non-deterministic 

printUsage :: IO ()  Deterministic 

argsToOptions :: [String] -> [Option]  Deterministic 

outDirOf :: [Option] -> String  Deterministic 

derive :: [Option] -> IO ()  Non-deterministic 

maybeString :: [(String,String)] -> [(String,String)]  Deterministic 

transModName :: String -> String  Deterministic 

toXmlName :: (String,String) -> (String,String)  Deterministic 

fromXmlName :: (String,String) -> (String,String)  Deterministic 

listTag :: [Option] -> String  Deterministic 

isTupleName :: String -> Bool  Deterministic 

tag :: [Option] -> String -> String  Deterministic 

tagNameForCons :: (String,String) -> String  Deterministic 

mkConsDecl2Xml :: [Option] -> [CPattern] -> CConsDecl -> CRule  Deterministic 

type2XmlType :: [(Int,String)] -> CTypeExpr -> CTypeExpr  Deterministic 

call2xml :: (CTypeExpr,Int) -> CExpr  Deterministic 

xml :: [Option] -> String -> [CExpr] -> [CExpr] -> CExpr  Deterministic 

xmlType :: CTypeExpr  Deterministic 

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

renVar :: (a,String) -> (a,String)  Deterministic 

xml2typeType :: [(Int,String)] -> CTypeExpr -> CTypeExpr  Deterministic 

mkXml2ConsDecl :: [Option] -> [CPattern] -> CConsDecl -> CRule  Deterministic 

renameUnused :: [(Int,String)] -> [CPattern] -> [CPattern]  Deterministic 

pxml :: [Option] -> String -> [CPattern] -> [CPattern] -> CPattern  Deterministic 

callXml2 :: (CTypeExpr,Int) -> CExpr  Deterministic 

importTypes :: String -> [(String,String)] -> IO [String]  Deterministic 

imessage :: [String] -> IO ()  Deterministic 

importType :: (String,String) -> String  Deterministic 

specialNames :: [String]  Deterministic 

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

specialFuncs :: [Option] -> [CFuncDecl]  Deterministic 

mkTupleType :: Int -> CTypeDecl  Deterministic 

mkList2xml :: [Option] -> CFuncDecl  Deterministic 

mkXml2List :: [Option] -> CFuncDecl  Deterministic 

baseType2xml :: [Option] -> String -> CFuncDecl  Deterministic 

baseTypeXml2 :: [Option] -> String -> CFuncDecl  Deterministic 

readFun :: String -> CExpr  Deterministic 

writeFun :: String -> CExpr  Deterministic 

requiredTypesTypeDecl :: CTypeDecl -> [(String,String)]  Deterministic 

yield list of all types the given type depends on

requiredTypesConsDecl :: CConsDecl -> [(String,String)]  Deterministic 

requiredTypesTypeExpr :: CTypeExpr -> [(String,String)]  Deterministic