diff options
Diffstat (limited to 'src/Model/Config.hs')
-rw-r--r-- | src/Model/Config.hs | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/src/Model/Config.hs b/src/Model/Config.hs deleted file mode 100644 index b583048..0000000 --- a/src/Model/Config.hs +++ /dev/null @@ -1,32 +0,0 @@ -{-# LANGUAGE OverloadedStrings #-} -{-# LANGUAGE FlexibleContexts #-} - -module Model.Config - ( getConfig - , Config(..) - ) where - -import Data.ConfigFile -import Data.Text (Text) -import qualified Data.Text as T - -import Control.Monad.Trans.Error (runErrorT) -import Control.Monad.IO.Class (liftIO) -import Control.Monad (join) -import Control.Arrow (left) - -data Config = Config - { mailTo :: Text - , mailFrom :: Text - , dayForNextWeekNotification :: Text - } deriving (Read, Eq, Show) - -getConfig :: FilePath -> IO (Either Text Config) -getConfig filePath = - left (T.pack . show) <$> (runErrorT $ do - cp <- join $ liftIO $ readfile emptyCP filePath - Config <$> - (T.pack <$> get cp "DEFAULT" "mail-to") <*> - (T.pack <$> get cp "DEFAULT" "mail-from") <*> - (T.pack <$> get cp "DEFAULT" "day-for-next-week-notification") - ) |