Safe Haskell | None |
---|---|
Language | Haskell2010 |
AUTHOR
- Dr. Alistair Ward
DESCRIPTION
- Describes the interface to an abstract user of resources.
Synopsis
- class ResourceUser resourceUser where
- areIndependent :: resourceUser -> resourceUser -> Bool
- areMergeableWith :: (Foldable foldable, Eq resourceIds, Eq level, ResourceUser resourceIds) => Lesson resourceIds level -> foldable (Lesson resourceIds level) -> Bool
- areMutuallyMergeable :: (Eq resourceIds, Eq level, ResourceUser resourceIds) => [Lesson resourceIds level] -> Bool
Type-classes
class ResourceUser resourceUser where Source #
An interface to which users of resources can conform.
:: resourceUser | |
-> resourceUser | |
-> Bool | Whether the resources used by the first instance, are independent of those used by the second. |
Instances
Ord resource => ResourceUser (Set resource) Source # | |
Defined in WeekDaze.Model.ResourceUser | |
Eq locationId => ResourceUser (LessonResourceIds locationId) Source # | |
Defined in WeekDaze.TeacherView.LessonResourceIds areIndependent :: LessonResourceIds locationId -> LessonResourceIds locationId -> Bool Source # | |
Eq teacherId => ResourceUser (LessonResourceIds teacherId) Source # | |
Defined in WeekDaze.LocationView.LessonResourceIds areIndependent :: LessonResourceIds teacherId -> LessonResourceIds teacherId -> Bool Source # | |
(Eq locationId, Eq teacherId) => ResourceUser (LessonResourceIds locationId teacherId) Source # | |
Defined in WeekDaze.StudentView.LessonResourceIds areIndependent :: LessonResourceIds locationId teacherId -> LessonResourceIds locationId teacherId -> Bool Source # |
Functions
Predicates
:: (Foldable foldable, Eq resourceIds, Eq level, ResourceUser resourceIds) | |
=> Lesson resourceIds level | The proposed lesson. |
-> foldable (Lesson resourceIds level) | The lessons already booked in the timetable, at the proposed time. |
-> Bool |
- Check whether the specified lesson is compatible with the incumbent collection of synchronous lessons.
- Each of the incumbent lessons must either be identical to the proposed lesson, or use completely different resources.
- This property allows the specified lesson to be booked into a timetable at the same time.
- CAVEAT: performance-hotspot.
areMutuallyMergeable :: (Eq resourceIds, Eq level, ResourceUser resourceIds) => [Lesson resourceIds level] -> Bool Source #
True
if all the listed lessons are identical, or none of their resource-Ids are common.- This property allows them to co-exist, when booked into the weekly timetables of distinct observers, but at the same time.
- CAVEAT: is pretty inefficient; all we're really want to do is
nub
the list of lessons, then check that neither of the two resources per lesson, is used more than once, it's just that we can't access the two resources, because they're behind the class-interface.