Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Functions to evaluate conditional restrictions.
Synopsis
- type ErrorMsg = String
- result :: [(ID, Value)] -> ConditionalRestriction -> Result ([ErrorMsg], [(ID, Type)]) (Maybe Token)
- fulfills :: [(ID, Value)] -> Condition -> Result (Either ErrorMsg (ID, Type)) Bool
- timeIn :: DateTime -> OpeningHours -> Bool
- ohTimes :: OpeningHours -> [TimeSelector]
- timeInSelector :: TimeOfDay -> TimeSelector -> Bool
- timeExtendedInSelector :: TimeOfDay -> TimeSelector -> Bool
- addTimespan :: TimeSpan -> TimeSelector -> TimeSelector
- subtractTimespan :: TimeSpan -> TimeSelector -> TimeSelector
- explicitExtended :: TimeSpan -> TimeSpan
- mapDays :: [WeekDay] -> (a -> a) -> [a] -> [a]
- combineWeekdays :: WeekdaySelector -> [WeekDay]
- range :: (Ord a, Enum a, Bounded a) => a -> a -> [a]
Documentation
result :: [(ID, Value)] -> ConditionalRestriction -> Result ([ErrorMsg], [(ID, Type)]) (Maybe Token) Source #
The result
function takes input data in the form of (ID
, Value
) and a ConditionalRestriction
and returns
the result of that ConditionalRestriction
when applied to the input data given. If data needed for the evaluation
is missing or of the wrong type, it will return a list of error messages and a list of missing data types instead.
Note that this function will accept incomplete data if it is enough to evaluate the expression, but will always return a complete list of needed data types.
timeIn :: DateTime -> OpeningHours -> Bool Source #
The timeIn
function returns wheter a DateTime
is within given OpeningHours
. Unknown values count as not
within the opening hours.
ohTimes :: OpeningHours -> [TimeSelector] Source #
timeInSelector :: TimeOfDay -> TimeSelector -> Bool Source #
timeExtendedInSelector :: TimeOfDay -> TimeSelector -> Bool Source #
addTimespan :: TimeSpan -> TimeSelector -> TimeSelector Source #
subtractTimespan :: TimeSpan -> TimeSelector -> TimeSelector Source #
explicitExtended :: TimeSpan -> TimeSpan Source #
combineWeekdays :: WeekdaySelector -> [WeekDay] Source #