time-patterns-0.1.3.0: Patterns for recurring events.

Copyright(C) 2013 Jann Mueller
LicenseBSD3 (see the file LICENSE)
Maintainerj.mueller.11@ucl.ac.uk
Stabilityexperimental
Safe HaskellSafe-Inferred
LanguageHaskell2010

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)
 

Instances

type IntervalSequence' t = IntervalSequence t t Source

IntervalSequences that can be evaluated repeatedly.

General combinators

never :: IntervalSequence t s Source

A sequence with no occurrences

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

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 s Source

Merge two sequences into one by switching between them

take :: (Num i, Ord i) => i -> IntervalSequence t s -> IntervalSequence t s Source

End a sequence after n occurrences

cycle :: Interval s -> IntervalSequence t s Source

Repeat a point infinitely

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

Take occurrences until an interval containing the argument is reached

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

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

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

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

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

Prepend an interval to an interval sequence

Combinators for IntervalSequence'

every :: (Num i, Ord i) => i -> IntervalSequence' t -> IntervalSequence' t Source

Take every nth occurrence

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

Accept results which satisfy a condition

elementOf :: Ord t => t -> IntervalSequence' t -> Bool Source

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 :: (Num i, Ord i) => i -> IntervalSequence' t -> IntervalSequence' t Source

Skip the first n occurrences of a sequence

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

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' t Source

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

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

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' t Source

Return intervals that are exactly the same

Other

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