weekdaze-0.0.0.2: A school-timetable problem-solver.

Safe HaskellNone
LanguageHaskell2010

WeekDaze.Model.ResourceUser

Contents

Description

AUTHOR
Dr. Alistair Ward
DESCRIPTION
Describes the interface to an abstract user of resources.
Synopsis

Type-classes

class ResourceUser resourceUser where Source #

An interface to which users of resources can conform.

Methods

areIndependent Source #

Arguments

:: 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 # 
Instance details

Defined in WeekDaze.Model.ResourceUser

Methods

areIndependent :: Set resource -> Set resource -> Bool Source #

Eq locationId => ResourceUser (LessonResourceIds locationId) Source # 
Instance details

Defined in WeekDaze.TeacherView.LessonResourceIds

Methods

areIndependent :: LessonResourceIds locationId -> LessonResourceIds locationId -> Bool Source #

Eq teacherId => ResourceUser (LessonResourceIds teacherId) Source # 
Instance details

Defined in WeekDaze.LocationView.LessonResourceIds

Methods

areIndependent :: LessonResourceIds teacherId -> LessonResourceIds teacherId -> Bool Source #

(Eq locationId, Eq teacherId) => ResourceUser (LessonResourceIds locationId teacherId) Source # 
Instance details

Defined in WeekDaze.StudentView.LessonResourceIds

Methods

areIndependent :: LessonResourceIds locationId teacherId -> LessonResourceIds locationId teacherId -> Bool Source #

Functions

Predicates

areMergeableWith Source #

Arguments

:: (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.