blob: a9d5731815528231ae64fdad02334b1edb72085f (
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 qualified RenderError
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, _) -> RenderError.birthdate err
(_, Left err) -> RenderError.config err
(Right birthdates, Right config) -> notifyTodayAndNextWeek birthdates config
|