module System.Cron.Internal.Describe.Descriptors where import System.Cron.Internal.Describe.Time import System.Cron.Internal.Describe.Types minuteDescriptor :: Descriptor minuteDescriptor :: Descriptor minuteDescriptor = Descriptor { pluralDesc :: String pluralDesc = String "minutes" , singularDesc :: String singularDesc = String "minute" , rangePrefix :: String rangePrefix = String "minutes" , rangeSuffix :: String rangeSuffix = String "past the hour" , rangeJoiner :: String rangeJoiner = String "through" , displayItem :: Int -> String displayItem = Int -> String forall a. Show a => a -> String show , specificPrefix :: String specificPrefix = String "at" , specificSuffix :: String specificSuffix = String "minutes past the hour" , stepSpecificSuffix :: Int -> Maybe String stepSpecificSuffix = Int -> Maybe String forall {a}. (Eq a, Num a, Show a) => a -> Maybe String sss , listPrefix :: String listPrefix = String "at" , listSuffix :: Maybe String listSuffix = Maybe String forall a. Maybe a Nothing } where sss :: a -> Maybe String sss a n | a n a -> a -> Bool forall a. Eq a => a -> a -> Bool == a 0 = Maybe String forall a. Maybe a Nothing | Bool otherwise = String -> Maybe String forall a. a -> Maybe a Just (String -> Maybe String) -> String -> Maybe String forall a b. (a -> b) -> a -> b $ String "starting at " String -> String -> String forall a. [a] -> [a] -> [a] ++ a -> String forall a. Show a => a -> String show a n String -> String -> String forall a. [a] -> [a] -> [a] ++ String " minutes past the hour" hourDescriptor :: TimeFormat -> Descriptor hourDescriptor :: TimeFormat -> Descriptor hourDescriptor TimeFormat tf = Descriptor { pluralDesc :: String pluralDesc = String "hours" , singularDesc :: String singularDesc = String "hour" , rangePrefix :: String rangePrefix = String "between" , rangeSuffix :: String rangeSuffix = String "" , rangeJoiner :: String rangeJoiner = String "and" , displayItem :: Int -> String displayItem = Int -> String toHour , specificPrefix :: String specificPrefix = String "at" , specificSuffix :: String specificSuffix = String "" , stepSpecificSuffix :: Int -> Maybe String stepSpecificSuffix = Int -> Maybe String sss , listPrefix :: String listPrefix = String "at" , listSuffix :: Maybe String listSuffix = Maybe String forall a. Maybe a Nothing } where toHour :: Int -> String toHour Int h = TimeFormat -> Minute -> Hour -> String format TimeFormat tf (Int -> Minute Minute Int 0) (Int -> Hour Hour Int h) sss :: Int -> Maybe String sss Int n | Int n Int -> Int -> Bool forall a. Eq a => a -> a -> Bool == Int 0 = Maybe String forall a. Maybe a Nothing | Bool otherwise = String -> Maybe String forall a. a -> Maybe a Just (String -> Maybe String) -> String -> Maybe String forall a b. (a -> b) -> a -> b $ String "starting at " String -> String -> String forall a. [a] -> [a] -> [a] ++ Int -> String toHour Int n domDescriptor :: Descriptor domDescriptor :: Descriptor domDescriptor = Descriptor { pluralDesc :: String pluralDesc = String "days" , singularDesc :: String singularDesc = String "day" , rangePrefix :: String rangePrefix = String "between days" , rangeSuffix :: String rangeSuffix = String "of the month" , rangeJoiner :: String rangeJoiner = String "and" , displayItem :: Int -> String displayItem = Int -> String forall a. Show a => a -> String show , specificPrefix :: String specificPrefix = String "on day" , specificSuffix :: String specificSuffix = String "of the month" , stepSpecificSuffix :: Int -> Maybe String stepSpecificSuffix = Int -> Maybe String forall {a}. Show a => a -> Maybe String sss , listPrefix :: String listPrefix = String "on days" , listSuffix :: Maybe String listSuffix = String -> Maybe String forall a. a -> Maybe a Just String "of the month" } where sss :: a -> Maybe String sss a n = String -> Maybe String forall a. a -> Maybe a Just (String -> Maybe String) -> String -> Maybe String forall a b. (a -> b) -> a -> b $ String "starting on day " String -> String -> String forall a. [a] -> [a] -> [a] ++ a -> String forall a. Show a => a -> String show a n String -> String -> String forall a. [a] -> [a] -> [a] ++ String " of the month" monthDescriptor :: Descriptor monthDescriptor :: Descriptor monthDescriptor = Descriptor { pluralDesc :: String pluralDesc = String "months" , singularDesc :: String singularDesc = String "month" , rangePrefix :: String rangePrefix = String "" , rangeSuffix :: String rangeSuffix = String "" , rangeJoiner :: String rangeJoiner = String "through" , displayItem :: Int -> String displayItem = Int -> String toMonth , specificPrefix :: String specificPrefix = String "only in" , specificSuffix :: String specificSuffix = String "" , stepSpecificSuffix :: Int -> Maybe String stepSpecificSuffix = Int -> Maybe String sss , listPrefix :: String listPrefix = String "only in" , listSuffix :: Maybe String listSuffix = Maybe String forall a. Maybe a Nothing } where toMonth :: Int -> String toMonth = Month -> String forall a. Show a => a -> String show (Month -> String) -> (Int -> Month) -> Int -> String forall b c a. (b -> c) -> (a -> b) -> a -> c . Int -> Month safeIntToMonth sss :: Int -> Maybe String sss Int n | Int n Int -> Int -> Bool forall a. Eq a => a -> a -> Bool == Int 1 = Maybe String forall a. Maybe a Nothing | Bool otherwise = String -> Maybe String forall a. a -> Maybe a Just (String -> Maybe String) -> String -> Maybe String forall a b. (a -> b) -> a -> b $ Int -> String toMonth Int n String -> String -> String forall a. [a] -> [a] -> [a] ++ String " through " String -> String -> String forall a. [a] -> [a] -> [a] ++ Int -> String toMonth Int 12 dowDescriptor :: Descriptor dowDescriptor :: Descriptor dowDescriptor = Descriptor { pluralDesc :: String pluralDesc = String "days of the week" , singularDesc :: String singularDesc = String "day of the week" , rangePrefix :: String rangePrefix = String "" , rangeSuffix :: String rangeSuffix = String "" , rangeJoiner :: String rangeJoiner = String "through" , displayItem :: Int -> String displayItem = Int -> String toWeekday , specificPrefix :: String specificPrefix = String "only on" , specificSuffix :: String specificSuffix = String "" , stepSpecificSuffix :: Int -> Maybe String stepSpecificSuffix = Int -> Maybe String sss , listPrefix :: String listPrefix = String "only on" , listSuffix :: Maybe String listSuffix = Maybe String forall a. Maybe a Nothing } where toWeekday :: Int -> String toWeekday = Weekday -> String forall a. Show a => a -> String show (Weekday -> String) -> (Int -> Weekday) -> Int -> String forall b c a. (b -> c) -> (a -> b) -> a -> c . Int -> Weekday safeIntToWeekDay sss :: Int -> Maybe String sss Int n = String -> Maybe String forall a. a -> Maybe a Just (String -> Maybe String) -> String -> Maybe String forall a b. (a -> b) -> a -> b $ Int -> String toWeekday Int n String -> String -> String forall a. [a] -> [a] -> [a] ++ String " through " String -> String -> String forall a. [a] -> [a] -> [a] ++ Weekday -> String forall a. Show a => a -> String show Weekday Saturday