File: UCD2Haskell.hs

package info (click to toggle)
haskell-unicode-data 0.4.0.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,024 kB
  • sloc: haskell: 26,394; makefile: 3
file content (38 lines) | stat: -rw-r--r-- 1,221 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
-- |
-- Module      : Main
-- Copyright   : (c) 2020 Composewell Technologies and Contributors
-- License     : Apache-2.0
-- Maintainer  : streamly@composewell.com
-- Stability   : experimental
--
module Main where

import GHC.Generics (Generic)
import Parser.Text (genCoreModules, genNamesModules, genScriptsModules, genSecurityModules)
import System.FilePath ((</>))
import WithCli (HasArguments(..), withCli)

data CLIOptions =
    CLIOptions
        { input :: FilePath
        , output_core :: FilePath
        -- ^ `unicode-data`
        , output_names :: FilePath
        -- ^ `unicode-data-names`
        , output_scripts :: FilePath
        -- ^ `unicode-data-scripts`
        , output_security :: FilePath
        -- ^ `unicode-data-security`
        , core_prop :: [String]
        }
    deriving (Show, Generic, HasArguments)

cliClient :: CLIOptions -> IO ()
cliClient opts
    = genCoreModules (input opts </> "ucd") (output_core opts) (core_prop opts)
    *> genNamesModules (input opts </> "ucd") (output_names opts)
    *> genScriptsModules (input opts </> "ucd") (output_scripts opts)
    *> genSecurityModules (input opts </> "security") (output_security opts)

main :: IO ()
main = withCli cliClient