GaBuZoMeu/Registry/registry2sqlite.hs

24 lines
643 B
Haskell

import qualified System.IO as IO
import Registry.Utils
import Registry.Utils.SQLite
import Registry.Grammar (registry)
import Registry.Registry
infile = "./language-subtag-registry"
displayAll reg thistype =
(foldr (++) "" (map toSQLite
(filter (onlyThisType thistype) reg)))
main = do
f <- IO.openFile (infile) IO.ReadMode
input <- 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;"