conditional-restriction-parser-0.1.0.4: Parser and interpreter of OpenStreetMap conditional restriction values
Safe HaskellSafe-Inferred
LanguageHaskell2010

ConditionalRestriction.Internal.Evaluate

Description

Functions to evaluate conditional restrictions.

Synopsis

Documentation

type ErrorMsg = String Source #

Plain text error message.

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.

fulfills :: [(ID, Value)] -> Condition -> Result (Either ErrorMsg (ID, Type)) Bool Source #

The fulfills function takes input data in the form of (ID, Value) and a Condition and returns whether that condition is fulfilled. If some data is missing, it will return the missing data ID and Type and if the given data is of the wrong type, it will return an error message.

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.

mapDays :: [WeekDay] -> (a -> a) -> [a] -> [a] Source #

range :: (Ord a, Enum a, Bounded a) => a -> a -> [a] Source #