{-# LANGUAGE OverloadedStrings #-} module Birthdate ( Birthdate(..) , fullname , age , filterBirthday ) where import Data.Text (Text) import qualified Data.Text as T import Date (Date, sameDayAndMonth, yearsGap) data Birthdate = Birthdate { date :: Date , firstname :: Text , lastname :: Text } deriving (Eq, Show) fullname :: Birthdate -> Text fullname d = T.concat [firstname d, " ", lastname d] age :: Date -> Birthdate -> Int age currentDate birthdate = yearsGap currentDate (date birthdate) filterBirthday :: Date -> [Birthdate] -> [Birthdate] filterBirthday d = filter (sameDayAndMonth d . date)