Option parser
This commit is contained in:
parent
7588229fff
commit
10d767157c
@ -32,6 +32,7 @@ executable koodihaaste
|
||||
build-depends: base >=4.12 && <4.13
|
||||
, servant
|
||||
, servant-server
|
||||
, optparse-generic
|
||||
, servant-client
|
||||
, servant-client-core
|
||||
, text
|
||||
|
19
src/Main.hs
19
src/Main.hs
@ -1,17 +1,28 @@
|
||||
{-# LANGUAGE RecordWildCards #-}
|
||||
{-# LANGUAGE DataKinds #-}
|
||||
{-# LANGUAGE DeriveGeneric #-}
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE RecordWildCards #-}
|
||||
{-# LANGUAGE TypeOperators #-}
|
||||
module Main where
|
||||
|
||||
import Control.Monad.App
|
||||
import Data.Config
|
||||
import Data.Language
|
||||
import qualified Data.Text.IO as T
|
||||
import Network.HTTP.Client.TLS (newTlsManager)
|
||||
import Options.Generic
|
||||
import Servant.Client
|
||||
import Server
|
||||
import qualified Data.Text.IO as T
|
||||
import Data.Language
|
||||
|
||||
newtype Cmd = Cmd (FilePath <?> "Config path")
|
||||
deriving Generic
|
||||
|
||||
instance ParseRecord Cmd
|
||||
|
||||
main :: IO ()
|
||||
main = do
|
||||
_config <- readConfigFromFile "config.yaml"
|
||||
Cmd (Helpful configPath) <- getRecord "koodihaaste"
|
||||
_config <- readConfigFromFile configPath
|
||||
manager <- newTlsManager
|
||||
_languageModel <- buildModel <$> T.readFile (_training _config)
|
||||
let state = App{..}
|
||||
|
Loading…
Reference in New Issue
Block a user