Copyright | (C) 2013 Jann Mueller |
---|---|
License | BSD3 (see the file LICENSE) |
Maintainer | j.mueller.11@ucl.ac.uk |
Stability | experimental |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Internal stuff for time patterns
- newtype IntervalSequence t s = IntervalSequence {
- nextInterval :: t -> Maybe (Interval s, IntervalSequence t s)
- type IntervalSequence' t = IntervalSequence t t
- never :: IntervalSequence t s
- union :: Ord s => IntervalSequence t s -> IntervalSequence t s -> IntervalSequence t s
- diag :: IntervalSequence t s -> IntervalSequence t s -> IntervalSequence t s
- take :: (Num i, Ord i) => i -> IntervalSequence t s -> IntervalSequence t s
- cycle :: Interval s -> IntervalSequence t s
- stopAt :: Ord s => Interval s -> IntervalSequence t s -> IntervalSequence t s
- stopAt' :: Ord s => s -> IntervalSequence t s -> IntervalSequence t s
- before :: Ord s => Interval s -> IntervalSequence t s -> IntervalSequence t s
- andThen :: Interval s -> IntervalSequence t s -> IntervalSequence t s
- every :: (Num i, Ord i) => i -> IntervalSequence' t -> IntervalSequence' t
- filter :: (Interval t -> Bool) -> IntervalSequence' t -> IntervalSequence' t
- elementOf :: Ord t => t -> IntervalSequence' t -> Bool
- occurrencesFrom :: t -> IntervalSequence' t -> [Interval t]
- elementsFrom :: Enum t => t -> IntervalSequence' t -> [t]
- mapSequence :: (a -> b) -> IntervalSequence t a -> IntervalSequence t b
- skip :: (Num i, Ord i) => i -> IntervalSequence' t -> IntervalSequence' t
- skipUntil :: Ord t => Interval t -> IntervalSequence' t -> IntervalSequence' t
- except :: (Enum t, Ord t) => t -> IntervalSequence' t -> IntervalSequence' t
- except' :: Ord t => Interval t -> IntervalSequence' t -> IntervalSequence' t
- firstOccurrenceIn :: (Enum t, Ord t) => t -> Interval t -> IntervalSequence' t -> Maybe (Interval t, IntervalSequence' t)
- intersect :: (Ord t, Enum t) => IntervalSequence' t -> IntervalSequence' t -> IntervalSequence' t
- elements :: Enum a => Interval a -> [a]
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.
IntervalSequence | |
|
Ord s => Monoid (IntervalSequence t s) |
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.
mapSequence :: (a -> b) -> IntervalSequence t a -> IntervalSequence t b Source
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