blob: 3a3426940782d7c7ae11aff9ca1549728cad9ae4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
{-# LANGUAGE OverloadedStrings #-}
module Main
( main
) where
import qualified Data.Text.IO as T
import Exit (exitWithParsingError)
import Notification (notifyTodayAndNextWeek)
import Model.Config
import Model.BirthdateParser (parseBirthdates)
import qualified Model.Path as Path
main :: IO ()
main = do
eitherBirthdates <- parseBirthdates <$> T.readFile Path.birthdate
eitherConfig <- getConfig Path.config
case (eitherBirthdates, eitherConfig) of
(Left err, _) -> exitWithParsingError Path.birthdate err
(_, Left err) -> exitWithParsingError Path.config err
(Right birthdates, Right config) -> notifyTodayAndNextWeek birthdates config
|