Copyright | (c) Target RWE 2023 |
---|---|
License | BSD3 |
Maintainer | bbrown@targetrwe.com ljackman@targetrwe.com dpritchard@targetrwe.com |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Synopsis
- newtype Predicate a = Predicate {
- getPredicate :: a -> Bool
- containsTag :: Ord t => [t] -> Predicate (Event t m a)
- findOccurrenceOfEvent :: Filterable f => (f (Event t m a) -> Maybe (Event t m a)) -> Predicate (Event t m a) -> f (Event t m a) -> Maybe (Event t m a)
- firstOccurrenceOfTag :: (Witherable f, Ord t) => [t] -> f (Event t m a) -> Maybe (Event t m a)
- lastOccurrenceOfTag :: (Witherable f, Ord t) => [t] -> f (Event t m a) -> Maybe (Event t m a)
- splitByTags :: (Filterable f, Ord t) => [t] -> [t] -> f (Event t m a) -> (f (Event t m a), f (Event t m a))
- filterEvents :: Filterable f => Predicate (Event t m a) -> f (Event t m a) -> f (Event t m a)
- tallyEvents :: Witherable f => Predicate (Event t m a) -> f (Event t m a) -> Int
Documentation
Predicate | |
|
Instances
Contravariant Predicate | A Without newtypes contramap :: (a' -> a) -> (Predicate a -> Predicate a') contramap f (Predicate g) = Predicate (g . f) |
Monoid (Predicate a) |
mempty :: Predicate a mempty = _ -> True |
Semigroup (Predicate a) |
(<>) :: Predicate a -> Predicate a -> Predicate a Predicate pred <> Predicate pred' = Predicate a -> pred a && pred' a |
ToDhall x => FromDhall (Predicate x) | |
Defined in Dhall.Marshal.Decode |
containsTag :: Ord t => [t] -> Predicate (Event t m a) Source #
Creates a predicate to check that an Event
contains
any of a given list of tags.
findOccurrenceOfEvent Source #
:: Filterable f | |
=> (f (Event t m a) -> Maybe (Event t m a)) | function used to select a single event after the container is filtered |
-> Predicate (Event t m a) | predicate by which to filter |
-> f (Event t m a) | a container of events |
-> Maybe (Event t m a) |
Filter a container of Event
s
to a single
,
based on a provided function,
with the provided tag set.Maybe
Event
For example,
see firstOccurrenceOfTag
and
lastOccurrenceOfTag
.
firstOccurrenceOfTag :: (Witherable f, Ord t) => [t] -> f (Event t m a) -> Maybe (Event t m a) Source #
Finds the *first* occurrence of an Event
with at least one of the tags
if one exists.
Assumes the input events are appropriately sorted.
lastOccurrenceOfTag :: (Witherable f, Ord t) => [t] -> f (Event t m a) -> Maybe (Event t m a) Source #
Finds the *last* occurrence of an Event
with at least one of the tags
if one exists.
Assumes the input events list are appropriately sorted.
splitByTags :: (Filterable f, Ord t) => [t] -> [t] -> f (Event t m a) -> (f (Event t m a), f (Event t m a)) Source #