import qualified System.IO import qualified Text.ParserCombinators.Parsec as Parsec import Registry.Utils import Registry.Grammar (registry) import Registry.Registry infile = "./language-subtag-registry" displayAll reg = "" ++ (foldr (++) "" (map toXML reg)) ++ "" displayOne reg thistype thisvalue = concat (map toXML (filter (onlyThisValue thistype thisvalue) reg)) foreach [] func = return () foreach a func = do func (head a) foreach (tail a) func main = do f <- System.IO.openFile (infile) System.IO.ReadMode input <- System.IO.hGetContents f let theregistry = getRegistry input let outfile = "language-subtag-registry.xml" f <- System.IO.openFile (outfile) System.IO.WriteMode System.IO.hPutStr f (displayAll theregistry) System.IO.hClose f