time-patterns-0.1.2.0: Patterns for reccurring events.

Stabilityexperimental
Maintainerj.mueller.11@ucl.ac.uk
Safe HaskellSafe-Inferred

Data.Time.Patterns.Internal

Contents

Description

Internal stuff for time patterns

Synopsis

Types

newtype IntervalSequence t s Source

A sequence of intervals, starting from a point. If the argument to nextInterval is part of an interval, then the result should be the interval containing it.

Constructors

IntervalSequence 

Fields

nextInterval :: t -> Maybe (Interval s, IntervalSequence t s)
 

type IntervalSequence' t = IntervalSequence t tSource

IntervalSequences that can be evaluated repeatedly.

General combinators

never :: IntervalSequence t sSource

A sequence with no occurrences

union :: Ord s => IntervalSequence t s -> IntervalSequence t s -> IntervalSequence t sSource

Occurrences from both intervals. The difference between union and diag is that union preserves the order of the results

diag :: IntervalSequence t s -> IntervalSequence t s -> IntervalSequence t sSource

Merge two sequences into one by switching between them

take :: Int -> IntervalSequence t s -> IntervalSequence t sSource

End a sequence after n occurrences

cycle :: Interval s -> IntervalSequence t sSource

Repeat a point infinitely

stopAt :: Ord s => Interval s -> IntervalSequence t s -> IntervalSequence t sSource

Take occurrences until an interval containing the argument is reached

stopAt' :: Ord s => s -> IntervalSequence t s -> IntervalSequence t sSource

Take occurrences until an interval whose supremum is greater than the argument is reached.

before :: Ord s => Interval s -> IntervalSequence t s -> IntervalSequence t sSource

Stop as soon as a result greater than or equal to the parameter is produced

andThen :: Interval s -> IntervalSequence t s -> IntervalSequence t sSource

Prepend an interval to an interval sequence

Combinators for IntervalSequence'

every :: Int -> IntervalSequence' t -> IntervalSequence' tSource

Take every nth occurrence

filter :: (Interval t -> Bool) -> IntervalSequence' t -> IntervalSequence' tSource

Accept results which satisfy a condition

elementOf :: Ord t => t -> IntervalSequence' t -> BoolSource

Check if a point is covered by an interval sequence

occurrencesFrom :: t -> IntervalSequence' t -> [Interval t]Source

The sequence of occurrences from an initial point.

elementsFrom :: Enum t => t -> IntervalSequence' t -> [t]Source

Elements covered by an interval sequence from an initial point.

skip :: Int -> IntervalSequence' t -> IntervalSequence' tSource

Skip the first n occurrences of a sequence

skipUntil :: Ord t => Interval t -> IntervalSequence' t -> IntervalSequence' tSource

Skip intervals until the infimum of the argument is reached.

If the intervals in the sequence are not ordered, then this function might not terminate.

except :: (Enum t, Ord t) => t -> IntervalSequence' t -> IntervalSequence' tSource

Skip over a point in the sequence. All occurrences of this datum are removed.

except' :: Ord t => Interval t -> IntervalSequence' t -> IntervalSequence' tSource

Skip over all intervals which contain the parameter

firstOccurrenceIn :: (Enum t, Ord t) => t -> Interval t -> IntervalSequence' t -> Maybe (Interval t, IntervalSequence' t)Source

Search for the first result within the specified interval, starting from a point.

If the intervals in the sequence are not ordered, then this function might not terminate.

intersect :: (Ord t, Enum t) => IntervalSequence' t -> IntervalSequence' t -> IntervalSequence' tSource

Return intervals that are exactly the same

Other

elements :: Enum a => Interval a -> [a]Source