blob: bc9b112f1d79ab09d25ae5a0a2ed02a79a1b45cb (
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.Conf
import Model.EventParser (parseEvents)
import qualified Model.Path as Path
main :: IO ()
main = do
eitherEvents <- parseEvents <$> T.readFile Path.event
eitherConf <- getConf Path.conf
case (eitherEvents, eitherConf) of
(Left err, _) -> exitWithParsingError Path.event err
(_, Left err) -> exitWithParsingError Path.conf err
(Right events, Right conf) -> notifyTodayAndNextWeek events conf
|