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: September 2015

Summary of exported operations:

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

Exported datatypes:


Option

Constructors:

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

Exported operations:

main :: IO ()   

printUsage :: IO ()   

argsToOptions :: [String] -> [Option]   

outDirOf :: [Option] -> String   

derive :: [Option] -> IO ()   

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

transModName :: String -> String   

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

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

listTag :: [Option] -> String   

isTupleName :: String -> Bool   

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

tagNameForCons :: (String,String) -> String   

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

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

call2xml :: (CTypeExpr,Int) -> CExpr   

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

xmlType :: CTypeExpr   

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

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

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

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

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

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

callXml2 :: (CTypeExpr,Int) -> CExpr   

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

imessage :: [String] -> IO ()   

importType :: (String,String) -> String   

specialNames :: [String]   

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

specialFuncs :: [Option] -> [CFuncDecl]   

mkTupleType :: Int -> CTypeDecl   

mkList2xml :: [Option] -> CFuncDecl   

mkXml2List :: [Option] -> CFuncDecl   

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

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

readFun :: String -> CExpr   

writeFun :: String -> CExpr   

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

yield list of all types the given type depends on

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

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