diff options
author | Joris | 2015-11-22 12:32:52 +0100 |
---|---|---|
committer | Joris | 2015-11-22 12:32:52 +0100 |
commit | f96d239772f1bea5a483acd2dea973de3535e2da (patch) | |
tree | 47af74bd077593df4430b6f977a1adb423310ab7 /src | |
parent | 82a16e953fcb9a692f3a5129085d95339c2988fb (diff) |
Check for list emptyness with null instead of length
Diffstat (limited to 'src')
-rw-r--r-- | src/Model/Mail.hs | 12 |
1 files changed, 6 insertions, 6 deletions
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 "" |