Basic implementation done
This commit is contained in:
23
src/Data/Config.hs
Normal file
23
src/Data/Config.hs
Normal file
@ -0,0 +1,23 @@
|
||||
{-# LANGUAGE DeriveGeneric #-}
|
||||
module Data.Config where
|
||||
|
||||
import Server (Port)
|
||||
import Solidabis.API (Token)
|
||||
|
||||
import Control.Monad.Trans (MonadIO, liftIO)
|
||||
import Data.Aeson (FromJSON)
|
||||
import Data.Yaml.Config
|
||||
import GHC.Generics (Generic)
|
||||
import Servant.Client (BaseUrl)
|
||||
|
||||
data Config
|
||||
= Config { _accessToken :: Token
|
||||
, _solidabisBase :: BaseUrl
|
||||
, _port :: Port
|
||||
, _training :: FilePath }
|
||||
deriving (Show, Generic)
|
||||
|
||||
instance FromJSON Config
|
||||
|
||||
readConfigFromFile :: MonadIO m => FilePath -> m Config
|
||||
readConfigFromFile path = liftIO $ loadYamlSettings [path] [] ignoreEnv
|
@ -14,6 +14,14 @@ data Model
|
||||
= Model { parts :: Map Text (Sum Int)
|
||||
, total :: Sum Int }
|
||||
|
||||
class HasModel a where
|
||||
getModel :: a -> Model
|
||||
setModel :: a -> Model -> a
|
||||
|
||||
instance HasModel Model where
|
||||
getModel = id
|
||||
setModel = const
|
||||
|
||||
ngram_size :: Int
|
||||
ngram_size = 3
|
||||
|
||||
|
Reference in New Issue
Block a user