From f96d239772f1bea5a483acd2dea973de3535e2da Mon Sep 17 00:00:00 2001 From: Joris Date: Sun, 22 Nov 2015 12:32:52 +0100 Subject: Check for list emptyness with null instead of length --- src/Model/Mail.hs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/Model/Mail.hs') diff --git a/src/Model/Mail.hs b/src/Model/Mail.hs index 2ae8df4..2af2159 100644 --- a/src/Model/Mail.hs +++ b/src/Model/Mail.hs @@ -20,13 +20,13 @@ mailSubject :: [Birthdate] -> [Birthdate] -> Text mailSubject birthdaysToday birthdaysNextWeek = T.concat [ "Hey, " - , if length birthdaysToday > 0 + , if not . null $ birthdaysToday then mailSubjectSentence Today birthdaysToday else "" - , if length birthdaysNextWeek > 0 + , if not . null $ birthdaysNextWeek then T.concat - [ if length birthdaysToday > 0 then " and " else "" + [ if not . null $ birthdaysToday then " and " else "" , mailSubjectSentence NextWeek birthdaysNextWeek ] else @@ -52,13 +52,13 @@ mailSubjectSentence event birthdates = mailBody :: Date -> [Birthdate] -> [Birthdate] -> Text mailBody currentDate birthdaysToday birthdaysNextWeek = T.concat - [ if length birthdaysToday > 0 + [ if not . null $ birthdaysToday then mailBodySentence Today currentDate birthdaysToday else "" - , if length birthdaysNextWeek > 0 + , if not . null $ birthdaysNextWeek then T.concat - [ if length birthdaysToday > 0 then " " else "" + [ if not . null $ birthdaysToday then " " else "" , mailBodySentence NextWeek currentDate birthdaysNextWeek ] else "" -- cgit v1.2.3