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]  Non-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)  Non-deterministic 
fromXmlName :: (String,String) -> (String,String)  Non-deterministic 
listTag :: [Option] -> String  Deterministic 
isTupleName :: String -> Bool  Deterministic 
tag :: [Option] -> String -> String  Deterministic 
tagNameForCons :: (String,String) -> String  Deterministic 
mkType2Xml :: [Option] -> CTypeDecl -> CFuncDecl  Non-deterministic 
mkConsDecl2Xml :: [Option] -> [CPattern] -> CConsDecl -> CRule  Non-deterministic 
type2XmlType :: [(Int,String)] -> CTypeExpr -> CTypeExpr  Deterministic 
call2xml :: (CTypeExpr,Int) -> CExpr  Non-deterministic 
call2xmlType :: CTypeExpr -> CExpr  Non-deterministic 
xml :: [Option] -> String -> [CExpr] -> [CExpr] -> CExpr  Deterministic 
xmlType :: CTypeExpr  Deterministic 
mkXml2Type :: [Option] -> CTypeDecl -> CFuncDecl  Non-deterministic 
renVar :: (a,String) -> (a,String)  Deterministic 
xml2typeType :: [(Int,String)] -> CTypeExpr -> CTypeExpr  Deterministic 
mkXml2ConsDecl :: [Option] -> [CPattern] -> CConsDecl -> CRule  Non-deterministic 
renameUnused :: [(Int,String)] -> [CPattern] -> [CPattern]  Deterministic 
pxml :: [Option] -> String -> [CPattern] -> [CPattern] -> CPattern  Deterministic 
callXml2 :: (CTypeExpr,Int) -> CExpr  Non-deterministic 
callXml2Type :: CTypeExpr -> CExpr  Non-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]  Non-deterministic 
mkTupleType :: Int -> CTypeDecl  Deterministic 
mkList2xml :: [Option] -> CFuncDecl  Non-deterministic 
mkXml2List :: [Option] -> CFuncDecl  Non-deterministic 
baseType2xml :: [Option] -> String -> CFuncDecl  Non-deterministic 
baseTypeXml2 :: [Option] -> String -> CFuncDecl  Non-deterministic 
readFun :: String -> CExpr  Non-deterministic 
writeFun :: String -> CExpr  Non-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]  Non-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)  Non-deterministic 

fromXmlName :: (String,String) -> (String,String)  Non-deterministic 

listTag :: [Option] -> String  Deterministic 

isTupleName :: String -> Bool  Deterministic 

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

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

mkConsDecl2Xml :: [Option] -> [CPattern] -> CConsDecl -> CRule  Non-deterministic 

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

call2xml :: (CTypeExpr,Int) -> CExpr  Non-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  Non-deterministic 

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

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

callXml2 :: (CTypeExpr,Int) -> CExpr  Non-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]  Non-deterministic 

mkTupleType :: Int -> CTypeDecl  Deterministic 

mkList2xml :: [Option] -> CFuncDecl  Non-deterministic 

mkXml2List :: [Option] -> CFuncDecl  Non-deterministic 

baseType2xml :: [Option] -> String -> CFuncDecl  Non-deterministic 

baseTypeXml2 :: [Option] -> String -> CFuncDecl  Non-deterministic 

readFun :: String -> CExpr  Non-deterministic 

writeFun :: String -> CExpr  Non-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