GaBuZoMeu/Registry/registry2sqlite.hs

24 lines
643 B
Haskell
Raw Permalink Normal View History

2023-06-09 09:42:58 +02:00
import qualified System.IO as IO
2023-06-08 21:49:35 +02:00
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;"