import qualified System.IO import Registry.Utils import Registry.Utils.PostgreSQL import Registry.Grammar (registry) import Registry.Registry infile = "./language-subtag-registry" displayAll reg thistype = (foldr (++) "" (map toPostgreSQL (filter (onlyThisType thistype) reg))) main = do f <- System.IO.openFile (infile) System.IO.ReadMode input <- System.IO.hGetContents f let theregistry = getRegistry input putStrLn "BEGIN;" putStrLn (displayAll theregistry "script") putStrLn (displayAll theregistry "region") putStrLn (displayAll theregistry "language") putStrLn (displayAll theregistry "variant") putStrLn "COMMIT;"