- data WeekDay
- data Month
- class Moment a where
- epoch :: a
- toDateTime :: a -> DateTime
- fromDateTime :: DateTime -> Maybe a
- scaleTime :: a -> Integer -> a
- scaleMonth :: a -> Integer -> a
- scaleYear :: a -> Integer -> a
- alterWeekNumber :: StartOfWeek -> a -> Int -> Maybe a
- alterYearDay :: a -> Int -> Maybe a
- alterSecond :: a -> Int -> Maybe a
- alterMinute :: a -> Int -> Maybe a
- alterHour :: a -> Int -> Maybe a
- alterDay :: a -> Int -> Maybe a
- alterMonth :: a -> Month -> Maybe a
- alterYear :: a -> Integer -> Maybe a
- next :: Interval -> Frequency -> a -> a
- prev :: Interval -> Frequency -> a -> a
- data DateTime = DateTime {}
- data InitialMoment a = InitialMoment {
- frequency :: Frequency
- interval :: Interval
- startOfWeek :: StartOfWeek
- moment :: a
- toInterval :: Integer -> Interval
- toStartOfWeek :: WeekDay -> StartOfWeek
- 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
- secondlyUTC :: InitialMoment UTCTime
- minutelyUTC :: InitialMoment UTCTime
- hourlyUTC :: InitialMoment UTCTime
- dailyUTC :: InitialMoment UTCTime
- weeklyUTC :: InitialMoment UTCTime
- monthlyUTC :: InitialMoment UTCTime
- yearlyUTC :: InitialMoment UTCTime
- enumYear :: (Moment a, Ord a) => a -> RecurringSchedule a
- enumMonth :: (Moment a, Ord a) => a -> RecurringSchedule a
- enumWeek :: (Moment a, Ord a) => a -> RecurringSchedule a
- 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 :: 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 :: Moment a => InitialMoment a -> (Schedule a -> RecurringSchedule a) -> [a]
- repeatSchedule' :: Moment a => InitialMoment a -> [a]
The WeekDay
type
Symbolic week days.
Note: The first Day of the Week is Monday TODO: Move this to a more general library
The Month
type
Symbolic months.
TODO: Move this to a more general library
The Moment
type class
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
Provide a default moment.
toDateTime :: a -> DateTimeSource
Convert a Moment
into a DateTime
fromDateTime :: DateTime -> Maybe aSource
Convert a DateTime
into a Moment
scaleTime :: a -> Integer -> aSource
Produce a new Moment
offset by a given number of seconds.
scaleMonth :: a -> Integer -> aSource
Produce a new Moment
offset by a given number of months.
scaleYear :: a -> Integer -> aSource
Produce a new Moment
offset by a given number of years.
alterWeekNumber :: StartOfWeek -> a -> Int -> Maybe aSource
Possibly produce a new Moment
shifted to a different week of the year.
alterYearDay :: a -> Int -> Maybe aSource
Possibly produce a new Moment
shifted to a different day of the year.
alterSecond :: a -> Int -> Maybe aSource
The 'alter*' methods can potentially produce invalid dates.
For each user-defined Moment
instance the definitions of
toDateTime
, fromDateTime
, alterWeekNumber
and alterYearDay
will determine if an altered Moment
that lands on an invalid date
in the given calendar will be reduced to Nothing
Possibly produce a new Moment
shifted to a different second of the day.
alterMinute :: a -> Int -> Maybe aSource
Possibly produce a new Moment
shifted to a different minute of the day.
alterHour :: a -> Int -> Maybe aSource
Possibly produce a new Moment
shifted to a different hour of the day.
alterDay :: a -> Int -> Maybe aSource
Possibly produce a new Moment
shifted to a different day of the month.
alterMonth :: a -> Month -> Maybe aSource
Possibly produce a new Moment
shifted to a different month of the year.
alterYear :: a -> Integer -> Maybe aSource
Possibly produce a new Moment
shifted to a different year.
next :: Interval -> Frequency -> a -> aSource
Produce a new Moment
in the future ocurring at (interval * freq)
prev :: Interval -> Frequency -> a -> aSource
Produce a new Moment
in the past ocurring at (-interval * freq)
The DateTime
type class
DateTime
data type
This is a componentized version of a time value
simmilar to a 'struct tm'
The InitialMoment
type
data InitialMoment a Source
The InitialMoment
datatype
InitialMoment | |
|
Show a => Show (InitialMoment a) |
toInterval :: Integer -> IntervalSource
toStartOfWeek :: WeekDay -> StartOfWeekSource
secondly :: Moment a => InitialMoment aSource
Default initial moments
minutely :: Moment a => InitialMoment aSource
hourly :: Moment a => InitialMoment aSource
daily :: Moment a => InitialMoment aSource
weekly :: Moment a => InitialMoment aSource
monthly :: Moment a => InitialMoment aSource
yearly :: Moment a => InitialMoment aSource
secondlyUTC :: InitialMoment UTCTimeSource
InitialMoment
defaults for UTCTime
Recurrence combinators
enumYear :: (Moment a, Ord a) => a -> RecurringSchedule aSource
enumYear
produces all days in the year starting with m
enumMonth :: (Moment a, Ord a) => a -> RecurringSchedule aSource
enumMonth
produces all days in the current month starting with m
enumWeek :: (Moment a, Ord a) => a -> RecurringSchedule aSource
enumWeek
produces all days in the current week starting with m
restrict :: Moment a => (a -> Bool) -> Schedule a -> RecurringSchedule aSource
restrict
, applied to a predicate and a Schedule
, returns a Schedule
of those moments that statisfy the predicate.
byWeekDays :: Moment a => [WeekDay] -> a -> BoolSource
byMonthDays :: Moment a => [Int] -> a -> BoolSource
byYearDays :: Moment a => [Int] -> a -> BoolSource
expand :: Moment a => (a -> Reader (InitialMoment a) [a]) -> Schedule a -> RecurringSchedule aSource
expand
, takes an expansion function and a Schedule
, and maps the
expansion function over the moments.
Each moment is then replaced with its expansions.
onWeekNumbers :: Moment a => [Int] -> a -> Reader (InitialMoment a) [a]Source
onMonthDays :: Moment a => [Int] -> a -> Reader (InitialMoment a) [a]Source
onYearDays :: Moment a => [Int] -> a -> Reader (InitialMoment a) [a]Source
onEachWeek :: (Moment a, Ord a) => a -> Reader (InitialMoment a) [a]Source
onEachMonth :: (Moment a, Ord a) => a -> Reader (InitialMoment a) [a]Source
onEachYear :: (Moment a, Ord a) => a -> Reader (InitialMoment a) [a]Source
repeatSchedule :: Moment a => InitialMoment a -> (Schedule a -> RecurringSchedule a) -> [a]Source
repeatSchedule
runs a schedule with a given init and rule r
repeatSchedule' :: Moment a => InitialMoment a -> [a]Source
repeatSchedule'
is like repeatSchedule
but it takes no rules