solidabis-koodihaaste/src/Main.hs

31 lines
910 B
Haskell
Raw Normal View History

2019-10-15 23:11:07 +03:00
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TypeOperators #-}
2019-10-15 19:47:54 +03:00
module Main where
2019-10-15 22:52:03 +03:00
import Control.Monad.App
import Data.Config
2019-10-15 23:11:07 +03:00
import Data.Language
import qualified Data.Text.IO as T
2019-10-15 22:52:03 +03:00
import Network.HTTP.Client.TLS (newTlsManager)
2019-10-15 23:11:07 +03:00
import Options.Generic
2019-10-15 22:52:03 +03:00
import Servant.Client
import Server
2019-10-15 23:11:07 +03:00
newtype Cmd = Cmd (FilePath <?> "Config path")
deriving Generic
instance ParseRecord Cmd
2019-10-15 22:52:03 +03:00
2019-10-15 19:47:54 +03:00
main :: IO ()
2019-10-15 22:52:03 +03:00
main = do
2019-10-15 23:11:07 +03:00
Cmd (Helpful configPath) <- getRecord "koodihaaste"
_config <- readConfigFromFile configPath
2019-10-15 22:52:03 +03:00
manager <- newTlsManager
_languageModel <- buildModel <$> T.readFile (_training _config)
let state = App{..}
_solidabisClient = ClientEnv manager (_solidabisBase _config) Nothing
runAppM state server