diff --git a/koodihaaste.cabal b/koodihaaste.cabal index f1ccebe..cf54248 100644 --- a/koodihaaste.cabal +++ b/koodihaaste.cabal @@ -32,6 +32,7 @@ executable koodihaaste build-depends: base >=4.12 && <4.13 , servant , servant-server + , optparse-generic , servant-client , servant-client-core , text diff --git a/src/Main.hs b/src/Main.hs index 2dd331e..4c61ef0 100644 --- a/src/Main.hs +++ b/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{..}