Safe Haskell | None |
---|---|
Language | Haskell2010 |
AUTHOR
- Dr. Alistair Ward
DESCRIPTION
- The time-slot within any day is identified by an abstract enumerable type, & is therefore only loosely related to time; i.e. in this representation, one would specify the first or perhaps the last time-slot, rather than booking for say exactly 9:30.
- The actual time can only be derived from the time-slot, using knowlege of the time at which the working-day began, & of the constant duration of each time-slot; but it's irrelevant to the scheduling-task.
- Because no absolute time is associated with specific time-slots within a day, lunch-time merely exists invisibly between two time-slots, & plays no part in the scheduling.
- The day & the abstract identifier of the time-slot within that day, together define the coordinates of a specific time-slot in the timetable.
- Day/Time modules may already exist in the Haskell-platform's standard library, but since no account of; time-zones, locales, or leap-years, is required, they're undoubtedly over-engineered for the requirement.
Synopsis
- type TimeSet timeslotId = Set (Time timeslotId)
- type TimesByDay timeslotId = Map Day (Set timeslotId)
- data Time timeslotId
- calculateNTimeslotsPerWeek :: NTimeslots -> NTimeslots
- calculateDistance :: Enum timeslotId => timeslotId -> timeslotId -> NTimeslots
- calculateAbsoluteDistance :: Enum timeslotId => timeslotId -> timeslotId -> NTimeslots
- categoriseByDay :: Ord timeslotId => TimeSet timeslotId -> TimesByDay timeslotId
- shift :: Enum timeslotId => NTimeslots -> timeslotId -> timeslotId
- shiftTime :: Enum timeslotId => NTimeslots -> Time timeslotId -> Time timeslotId
- mkTime :: Day -> timeslotId -> Time timeslotId
Types
Type-synonyms
Data-types
Defines the coordinates of specific time-slot, within a given week.
Instances
Eq timeslotId => Eq (Time timeslotId) Source # | |
Ord timeslotId => Ord (Time timeslotId) Source # | |
Defined in WeekDaze.Temporal.Time compare :: Time timeslotId -> Time timeslotId -> Ordering # (<) :: Time timeslotId -> Time timeslotId -> Bool # (<=) :: Time timeslotId -> Time timeslotId -> Bool # (>) :: Time timeslotId -> Time timeslotId -> Bool # (>=) :: Time timeslotId -> Time timeslotId -> Bool # max :: Time timeslotId -> Time timeslotId -> Time timeslotId # min :: Time timeslotId -> Time timeslotId -> Time timeslotId # | |
Read timeslotId => Read (Time timeslotId) Source # | |
Show timeslotId => Show (Time timeslotId) Source # | |
NFData timeslotId => NFData (Time timeslotId) Source # | |
Defined in WeekDaze.Temporal.Time | |
XmlPickler timeslotId => XmlPickler (Time timeslotId) Source # | |
Defined in WeekDaze.Temporal.Time | |
HTML timeslotId => HTML (Time timeslotId) Source # | |
Defined in WeekDaze.Temporal.Time |
Constants
Functions
calculateNTimeslotsPerWeek :: NTimeslots -> NTimeslots Source #
Calculates the number of time-slots in a week, when provided by the number of time-slots per day.
calculateDistance :: Enum timeslotId => timeslotId -> timeslotId -> NTimeslots Source #
The signed distance between time-slots.
calculateAbsoluteDistance :: Enum timeslotId => timeslotId -> timeslotId -> NTimeslots Source #
The absolute distance between time-slots.
categoriseByDay :: Ord timeslotId => TimeSet timeslotId -> TimesByDay timeslotId Source #
- Categorise the specified times, according to their day.
- CAVEAT: some days have zero meetings, & therefore don't have a key in the resulting map.
shift :: Enum timeslotId => NTimeslots -> timeslotId -> timeslotId Source #
Shift the time-slot by the specified number of places.
shiftTime :: Enum timeslotId => NTimeslots -> Time timeslotId -> Time timeslotId Source #
Shift the time by the specified number of time-slots.