-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Generate recurring dates. -- -- time-recurrence is a library for generating recurring dates. It is -- based on the iCalendar spec (RFC 5545). However it makes no attempt to -- strictly follow the spec. @package time-recurrence @version 0.4.2 module Data.Time.Recurrence -- | Symbolic week days. -- -- Note: The first Day of the Week is Monday TODO: Move this to a more -- general library data WeekDay Monday :: WeekDay Tuesday :: WeekDay Wednesday :: WeekDay Thursday :: WeekDay Friday :: WeekDay Saturday :: WeekDay Sunday :: WeekDay -- | Symbolic months. -- -- TODO: Move this to a more general library data Month January :: Month February :: Month March :: Month April :: Month May :: Month June :: Month July :: Month August :: Month September :: Month October :: Month November :: Month December :: Month -- | The Moment class is for representing a instance in time. -- -- Instances of Moment can be derived for any user-defined -- datatype for which can satisfy the minimal complete definition. -- -- Minimal complete definition: epoch, toDateTime, -- fromDateTime, scaleTime, scaleMonth, -- scaleYear, alterWeekNumber, alterYearDay class Moment a epoch :: Moment a => a toDateTime :: Moment a => a -> DateTime fromDateTime :: Moment a => DateTime -> Maybe a scaleTime :: Moment a => a -> Integer -> a scaleMonth :: Moment a => a -> Integer -> a scaleYear :: Moment a => a -> Integer -> a alterWeekNumber :: Moment a => StartOfWeek -> a -> Int -> Maybe a alterYearDay :: Moment a => a -> Int -> Maybe a alterSecond :: Moment a => a -> Int -> Maybe a alterMinute :: Moment a => a -> Int -> Maybe a alterHour :: Moment a => a -> Int -> Maybe a alterDay :: Moment a => a -> Int -> Maybe a alterMonth :: Moment a => a -> Month -> Maybe a alterYear :: Moment a => a -> Integer -> Maybe a next :: Moment a => Interval -> Frequency -> a -> a prev :: Moment a => Interval -> Frequency -> a -> a -- | DateTime data type This is a componentized version of a time -- value simmilar to a 'struct tm' data DateTime DateTime :: Int -> Int -> Int -> Int -> Month -> Integer -> WeekDay -> Int -> TimeZone -> DateTime dtSecond :: DateTime -> Int dtMinute :: DateTime -> Int dtHour :: DateTime -> Int dtDay :: DateTime -> Int dtMonth :: DateTime -> Month dtYear :: DateTime -> Integer dtWeekDay :: DateTime -> WeekDay dtYearDay :: DateTime -> Int dtTimeZone :: DateTime -> TimeZone -- | The InitialMoment datatype data InitialMoment a InitialMoment :: Frequency -> Interval -> StartOfWeek -> a -> InitialMoment a frequency :: InitialMoment a -> Frequency interval :: InitialMoment a -> Interval startOfWeek :: InitialMoment a -> StartOfWeek moment :: InitialMoment a -> a toInterval :: Integer -> Interval toStartOfWeek :: WeekDay -> StartOfWeek -- | Default initial moments secondly :: Moment a => InitialMoment a minutely :: Moment a => InitialMoment a hourly :: Moment a => InitialMoment a daily :: Moment a => InitialMoment a weekly :: Moment a => InitialMoment a monthly :: Moment a => InitialMoment a yearly :: Moment a => InitialMoment a -- | InitialMoment defaults for UTCTime secondlyUTC :: InitialMoment UTCTime minutelyUTC :: InitialMoment UTCTime hourlyUTC :: InitialMoment UTCTime dailyUTC :: InitialMoment UTCTime weeklyUTC :: InitialMoment UTCTime monthlyUTC :: InitialMoment UTCTime yearlyUTC :: InitialMoment UTCTime -- | enumYear produces all days in the year starting with m enumYear :: (Moment a, Ord a) => a -> RecurringSchedule a -- | enumMonth produces all days in the current month starting with -- m enumMonth :: (Moment a, Ord a) => a -> RecurringSchedule a -- | enumWeek produces all days in the current week starting with -- m enumWeek :: (Moment a, Ord a) => a -> RecurringSchedule a -- | restrict, applied to a predicate and a Schedule, -- returns a Schedule of those moments that statisfy the -- predicate. restrict :: Moment a => (a -> Bool) -> Schedule a -> RecurringSchedule a bySeconds :: Moment a => [Int] -> a -> Bool byMinutes :: Moment a => [Int] -> a -> Bool byHours :: Moment a => [Int] -> a -> Bool byWeekDays :: Moment a => [WeekDay] -> a -> Bool byMonthDays :: Moment a => [Int] -> a -> Bool byMonths :: Moment a => [Month] -> a -> Bool byYearDays :: Moment a => [Int] -> a -> Bool -- | expand, takes an expansion function and a Schedule, -- and maps the expansion function over the moments. Each moment is then -- replaced with its expansions. expand :: Moment a => (a -> Reader (InitialMoment a) [a]) -> Schedule a -> RecurringSchedule a onWeekNumbers :: Moment a => [Int] -> a -> Reader (InitialMoment a) [a] onMonths :: Moment a => [Month] -> a -> Reader (InitialMoment a) [a] onMonthDays :: Moment a => [Int] -> a -> Reader (InitialMoment a) [a] onYearDays :: Moment a => [Int] -> a -> Reader (InitialMoment a) [a] onEachWeek :: (Moment a, Ord a) => a -> Reader (InitialMoment a) [a] onEachMonth :: (Moment a, Ord a) => a -> Reader (InitialMoment a) [a] onEachYear :: (Moment a, Ord a) => a -> Reader (InitialMoment a) [a] -- | repeatSchedule runs a schedule with a given init and -- rule r repeatSchedule :: Moment a => InitialMoment a -> (Schedule a -> RecurringSchedule a) -> [a] -- | repeatSchedule' is like repeatSchedule but it takes no -- rules repeatSchedule' :: Moment a => InitialMoment a -> [a] instance Show WeekDay instance Eq WeekDay instance Ord WeekDay instance Enum WeekDay instance Bounded WeekDay instance Show Month instance Eq Month instance Ord Month instance Bounded Month instance Show DateTime instance Show Frequency instance Show Interval instance Show StartOfWeek instance Show a => Show (InitialMoment a) instance Show a => Show (Schedule a) instance Eq a => Eq (Schedule a) instance Ord a => Ord (Schedule a) instance Moment UTCTime instance Enum Month