From 7825b27d262af7252b48e9179a5bbf86b0f30d22 Mon Sep 17 00:00:00 2001 From: Joris Date: Sat, 10 Oct 2015 11:22:03 +0200 Subject: More readable birthdates in csv file --- src/Main.hs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/Main.hs') diff --git a/src/Main.hs b/src/Main.hs index 9debfe1..9b5541c 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -10,7 +10,8 @@ import qualified Data.Text as T import qualified Data.Text.IO as T import Date (getCurrentDate) -import Birthdate (readBirthdates, filterBirthday) +import Birthdate (filterBirthday) +import BirthdateParser (parseBirthdates) import Mail (mailSubject, mailBody) import SendMail (sendMail) import Config @@ -23,24 +24,24 @@ configPath = "config.txt" main :: IO () main = do - eitherBirthdates <- readBirthdates birthdatePath + eitherBirthdates <- parseBirthdates <$> T.readFile birthdatePath eitherConfig <- getConfig configPath case (eitherBirthdates, eitherConfig) of - (Left error, _) -> + (Left err, _) -> T.hPutStr stderr $ T.concat [ "Error while parsing file " , T.pack birthdatePath , ":\n" - , error + , err ] - (_, Left error) -> + (_, Left err) -> T.hPutStr stderr $ T.concat [ "Error while parsing config file " , T.pack birthdatePath , ":\n" - , error + , err ] (Right birthdates, Right config) -> do currentDate <- getCurrentDate -- cgit v1.2.3