event-data-theory-0.30.3: event data theory
Copyright(c) Target RWE 2023
LicenseBSD3
Maintainerbbrown@targetrwe.com ljackman@targetrwe.com dpritchard@targetrwe.com
Safe HaskellSafe-Inferred
LanguageHaskell2010

EventDataTheory.Core

Description

Events may be represented in different structures for transferring or storing data, for example. The To/FromJSON instances for types defined in this module are derived generically. These can be useful for writing tests, for example, but they are not designed to encode/decode data in the new line delimited format defined in the event data model docs See the neighboring EventLine module for types and To/FromJSON instances designed for the purpose of marshaling data from JSON lines.

Synopsis

Documentation

data Event t m a Source #

The Event type puts a certain amount of structure on temporally organized data, while being flexible in the details. An 'Event t m a' contains information about when something occurred (the 'Interval a') and what occurred (the 'Context m t'). The type parameters m, t, and a allow to specify the types for the Contexts model and tagSet and for the type of the Interval end points.

The Event type parameters are ordered from changing the least often to most often. A model tends to be shared across projects. For example, multiple projects use data from insurance claims, and thus share a single model. A project often defines its own tagSet, though tag sets can be shared across projects. Within a project, multiple Interval types may used. Data may be imported as 'Interval Day', but then modified to 'Interval Integer' based on some reference point.

The contents of a Context are explained in a separate section, but we give a couple examples of using events here.

The event function is a smart constructor for Event.

>>> :set -XOverloadedStrings
>>> import IntervalAlgebra ( beginerval )
>>> data SomeModel = A | B deriving (Eq, Ord, Show, Generic)
>>> 
>>> type MyEvent = Event T.Text SomeModel Integer
>>> let myEvent = event (beginerval 5 0) (context (packTagSet ["foo"]) A Nothing) :: MyEvent
>>> show myEvent
"MkEvent {(0, 5), MkContext {getTagSet = MkTagSet (fromList [MkTag \"foo\"]), getFacts = A, getSource = Nothing}}"
>>> hasAnyTag myEvent (["foo", "duck"] :: [T.Text])
True
>>> hasAllTags myEvent (["foo", "duck"] :: [T.Text])
False
>>> data NewModel = A T.Text | B Integer deriving (Eq, Ord, Show, Generic)
>>> data MyTagSet = Foo | Bar | Baz deriving (Eq, Ord, Show, Generic)
>>> 
>>> type NewEvent = Event MyTagSet NewModel Integer
>>> let newEvent = event (beginerval 5 0) (context (packTagSet [Foo, Bar]) (A "cool") Nothing) :: NewEvent
>>> show newEvent
"MkEvent {(0, 5), MkContext {getTagSet = MkTagSet (fromList [MkTag Foo,MkTag Bar]), getFacts = A \"cool\", getSource = Nothing}}"
>>> hasTag newEvent Foo
True
>>> hasTag newEvent Baz
False

Instances

Instances details
Intervallic (Event t m) Source # 
Instance details

Defined in EventDataTheory.Core

Methods

getInterval :: Event t m a -> Interval a

setInterval :: Event t m a -> Interval b -> Event t m b

(SizedIv (Interval a), Eventable t m a) => TryFrom (EventLine t m a, ParseEventLineOption) (Event t m a)

Try to parse an EventLine into an Event, given an ParseEventLineOption.

Instance details

Defined in EventDataTheory.EventLines

Methods

tryFrom :: (EventLine t m a, ParseEventLineOption) -> Either (TryFromException (EventLine t m a, ParseEventLineOption) (Event t m a)) (Event t m a)

(Ord t, Arbitrary m, Arbitrary t, Arbitrary (Interval a)) => Arbitrary (Event t m a) Source # 
Instance details

Defined in EventDataTheory.Core

Methods

arbitrary :: Gen (Event t m a)

shrink :: Event t m a -> [Event t m a]

(Ord t, FromJSON t, FromJSON m, FromJSON a) => FromJSON (Event t m a) Source # 
Instance details

Defined in EventDataTheory.Core

Methods

parseJSON :: Value -> Parser (Event t m a)

parseJSONList :: Value -> Parser [Event t m a]

(Ord t, ToJSON t, ToJSON m, ToJSON a) => ToJSON (Event t m a) Source # 
Instance details

Defined in EventDataTheory.Core

Methods

toJSON :: Event t m a -> Value

toEncoding :: Event t m a -> Encoding

toJSONList :: [Event t m a] -> Value

toEncodingList :: [Event t m a] -> Encoding

Generic (Event t m a) Source # 
Instance details

Defined in EventDataTheory.Core

Associated Types

type Rep (Event t m a) :: Type -> Type #

Methods

from :: Event t m a -> Rep (Event t m a) x #

to :: Rep (Event t m a) x -> Event t m a #

(Show t, Show m, Show a, Ord a) => Show (Event t m a) Source # 
Instance details

Defined in EventDataTheory.Core

Methods

showsPrec :: Int -> Event t m a -> ShowS #

show :: Event t m a -> String #

showList :: [Event t m a] -> ShowS #

(Binary m, Binary t, Binary a) => Binary (Event t m a) Source # 
Instance details

Defined in EventDataTheory.Core

Methods

put :: Event t m a -> Put #

get :: Get (Event t m a) #

putList :: [Event t m a] -> Put #

(NFData a, NFData m, NFData t) => NFData (Event t m a) Source # 
Instance details

Defined in EventDataTheory.Core

Methods

rnf :: Event t m a -> () #

(Eq a, Eq t, Eq m) => Eq (Event t m a) Source # 
Instance details

Defined in EventDataTheory.Core

Methods

(==) :: Event t m a -> Event t m a -> Bool #

(/=) :: Event t m a -> Event t m a -> Bool #

(Ord a, Ord t, Eq m) => Ord (Event t m a) Source # 
Instance details

Defined in EventDataTheory.Core

Methods

compare :: Event t m a -> Event t m a -> Ordering #

(<) :: Event t m a -> Event t m a -> Bool #

(<=) :: Event t m a -> Event t m a -> Bool #

(>) :: Event t m a -> Event t m a -> Bool #

(>=) :: Event t m a -> Event t m a -> Bool #

max :: Event t m a -> Event t m a -> Event t m a #

min :: Event t m a -> Event t m a -> Event t m a #

Ord t => HasTag (Event t m a) t Source # 
Instance details

Defined in EventDataTheory.Core

Methods

hasTag :: Event t m a -> t -> Bool Source #

From (Event t m a) (Interval a) Source # 
Instance details

Defined in EventDataTheory.Core

Methods

from :: Event t m a -> Interval a

From (Event t m a) (TagSetInterval t a) Source # 
Instance details

Defined in EventDataTheory.Core

Methods

from :: Event t m a -> TagSetInterval t a

type Rep (Event t m a) Source # 
Instance details

Defined in EventDataTheory.Core

type Rep (Event t m a) = D1 ('MetaData "Event" "EventDataTheory.Core" "event-data-theory-0.30.3-inplace" 'True) (C1 ('MetaCons "MkEvent" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (PairedInterval (Context t m) a))))

event :: Interval a -> Context t m -> Event t m a Source #

A smart constructor for 'Event t m a's.

getEvent :: Event t m a -> PairedInterval (Context t m) a Source #

Unpack an Event from its constructor.

getContext :: Event t m a -> Context t m Source #

Get the Context of an Event.

data Source Source #

A Source may be used to record the source of an event from a database. This data is sometimes useful for debugging. We generally discourage using Source information in defining features.

Constructors

MkSource 

Instances

Instances details
FromJSON Source Source # 
Instance details

Defined in EventDataTheory.Core

Methods

parseJSON :: Value -> Parser Source

parseJSONList :: Value -> Parser [Source]

ToJSON Source Source # 
Instance details

Defined in EventDataTheory.Core

Methods

toJSON :: Source -> Value

toEncoding :: Source -> Encoding

toJSONList :: [Source] -> Value

toEncodingList :: [Source] -> Encoding

Generic Source Source # 
Instance details

Defined in EventDataTheory.Core

Associated Types

type Rep Source :: Type -> Type #

Methods

from :: Source -> Rep Source x #

to :: Rep Source x -> Source #

Show Source Source # 
Instance details

Defined in EventDataTheory.Core

Binary Source Source # 
Instance details

Defined in EventDataTheory.Core

Methods

put :: Source -> Put #

get :: Get Source #

putList :: [Source] -> Put #

NFData Source Source # 
Instance details

Defined in EventDataTheory.Core

Methods

rnf :: Source -> () #

Eq Source Source # 
Instance details

Defined in EventDataTheory.Core

Methods

(==) :: Source -> Source -> Bool #

(/=) :: Source -> Source -> Bool #

EventPredicate (Maybe Source) t m a Source # 
Instance details

Defined in EventDataTheory.Core

type Rep Source Source # 
Instance details

Defined in EventDataTheory.Core

data Tag t Source #

A Tag is simply a label for an Event.

Instances

Instances details
Functor Tag Source # 
Instance details

Defined in EventDataTheory.Core

Methods

fmap :: (a -> b) -> Tag a -> Tag b #

(<$) :: a -> Tag b -> Tag a #

From t (Tag t) Source # 
Instance details

Defined in EventDataTheory.Core

Methods

from :: t -> Tag t

FromJSON t => FromJSON (Tag t) Source # 
Instance details

Defined in EventDataTheory.Core

Methods

parseJSON :: Value -> Parser (Tag t)

parseJSONList :: Value -> Parser [Tag t]

ToJSON t => ToJSON (Tag t) Source # 
Instance details

Defined in EventDataTheory.Core

Methods

toJSON :: Tag t -> Value

toEncoding :: Tag t -> Encoding

toJSONList :: [Tag t] -> Value

toEncodingList :: [Tag t] -> Encoding

Generic (Tag t) Source # 
Instance details

Defined in EventDataTheory.Core

Associated Types

type Rep (Tag t) :: Type -> Type #

Methods

from :: Tag t -> Rep (Tag t) x #

to :: Rep (Tag t) x -> Tag t #

Show t => Show (Tag t) Source # 
Instance details

Defined in EventDataTheory.Core

Methods

showsPrec :: Int -> Tag t -> ShowS #

show :: Tag t -> String #

showList :: [Tag t] -> ShowS #

Binary t => Binary (Tag t) Source # 
Instance details

Defined in EventDataTheory.Core

Methods

put :: Tag t -> Put #

get :: Get (Tag t) #

putList :: [Tag t] -> Put #

NFData t => NFData (Tag t) Source # 
Instance details

Defined in EventDataTheory.Core

Methods

rnf :: Tag t -> () #

FromDhall t => FromDhall (Tag t) Source # 
Instance details

Defined in EventDataTheory.Core

Methods

autoWith :: InputNormalizer -> Decoder (Tag t)

ToDhall t => ToDhall (Tag t) Source # 
Instance details

Defined in EventDataTheory.Core

Methods

injectWith :: InputNormalizer -> Encoder (Tag t)

Eq t => Eq (Tag t) Source # 
Instance details

Defined in EventDataTheory.Core

Methods

(==) :: Tag t -> Tag t -> Bool #

(/=) :: Tag t -> Tag t -> Bool #

Ord t => Ord (Tag t) Source # 
Instance details

Defined in EventDataTheory.Core

Methods

compare :: Tag t -> Tag t -> Ordering #

(<) :: Tag t -> Tag t -> Bool #

(<=) :: Tag t -> Tag t -> Bool #

(>) :: Tag t -> Tag t -> Bool #

(>=) :: Tag t -> Tag t -> Bool #

max :: Tag t -> Tag t -> Tag t #

min :: Tag t -> Tag t -> Tag t #

From (Tag t) t Source # 
Instance details

Defined in EventDataTheory.Core

Methods

from :: Tag t -> t

Ord t => From (Set (Tag t)) (TagSet t) Source # 
Instance details

Defined in EventDataTheory.Core

Methods

from :: Set (Tag t) -> TagSet t

Ord t => From (Set (Tag t)) [t] Source # 
Instance details

Defined in EventDataTheory.Core

Methods

from :: Set (Tag t) -> [t]

Ord t => From (TagSet t) (Set (Tag t)) Source # 
Instance details

Defined in EventDataTheory.Core

Methods

from :: TagSet t -> Set (Tag t)

Ord t => From [t] (Set (Tag t)) Source # 
Instance details

Defined in EventDataTheory.Core

Methods

from :: [t] -> Set (Tag t)

type Rep (Tag t) Source # 
Instance details

Defined in EventDataTheory.Core

type Rep (Tag t) = D1 ('MetaData "Tag" "EventDataTheory.Core" "event-data-theory-0.30.3-inplace" 'True) (C1 ('MetaCons "MkTag" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 t)))

data TagSet t Source #

TagSet t is a Set of 'Tag t's. TagSet inherit the monoidal properties of Set, by union.

Instances

Instances details
(Arbitrary t, Ord t) => Arbitrary (TagSet t) Source # 
Instance details

Defined in EventDataTheory.Core

Methods

arbitrary :: Gen (TagSet t)

shrink :: TagSet t -> [TagSet t]

(Ord t, FromJSON t) => FromJSON (TagSet t) Source # 
Instance details

Defined in EventDataTheory.Core

Methods

parseJSON :: Value -> Parser (TagSet t)

parseJSONList :: Value -> Parser [TagSet t]

ToJSON t => ToJSON (TagSet t) Source # 
Instance details

Defined in EventDataTheory.Core

Methods

toJSON :: TagSet t -> Value

toEncoding :: TagSet t -> Encoding

toJSONList :: [TagSet t] -> Value

toEncodingList :: [TagSet t] -> Encoding

Ord t => Monoid (TagSet t) Source # 
Instance details

Defined in EventDataTheory.Core

Methods

mempty :: TagSet t #

mappend :: TagSet t -> TagSet t -> TagSet t #

mconcat :: [TagSet t] -> TagSet t #

Ord t => Semigroup (TagSet t) Source # 
Instance details

Defined in EventDataTheory.Core

Methods

(<>) :: TagSet t -> TagSet t -> TagSet t #

sconcat :: NonEmpty (TagSet t) -> TagSet t #

stimes :: Integral b => b -> TagSet t -> TagSet t #

Generic (TagSet t) Source # 
Instance details

Defined in EventDataTheory.Core

Associated Types

type Rep (TagSet t) :: Type -> Type #

Methods

from :: TagSet t -> Rep (TagSet t) x #

to :: Rep (TagSet t) x -> TagSet t #

Show t => Show (TagSet t) Source # 
Instance details

Defined in EventDataTheory.Core

Methods

showsPrec :: Int -> TagSet t -> ShowS #

show :: TagSet t -> String #

showList :: [TagSet t] -> ShowS #

Binary t => Binary (TagSet t) Source # 
Instance details

Defined in EventDataTheory.Core

Methods

put :: TagSet t -> Put #

get :: Get (TagSet t) #

putList :: [TagSet t] -> Put #

NFData t => NFData (TagSet t) Source # 
Instance details

Defined in EventDataTheory.Core

Methods

rnf :: TagSet t -> () #

(FromDhall t, Ord t, Show t) => FromDhall (TagSet t) Source # 
Instance details

Defined in EventDataTheory.Core

Methods

autoWith :: InputNormalizer -> Decoder (TagSet t)

ToDhall t => ToDhall (TagSet t) Source # 
Instance details

Defined in EventDataTheory.Core

Methods

injectWith :: InputNormalizer -> Encoder (TagSet t)

Eq t => Eq (TagSet t) Source # 
Instance details

Defined in EventDataTheory.Core

Methods

(==) :: TagSet t -> TagSet t -> Bool #

(/=) :: TagSet t -> TagSet t -> Bool #

Ord t => Ord (TagSet t) Source # 
Instance details

Defined in EventDataTheory.Core

Methods

compare :: TagSet t -> TagSet t -> Ordering #

(<) :: TagSet t -> TagSet t -> Bool #

(<=) :: TagSet t -> TagSet t -> Bool #

(>) :: TagSet t -> TagSet t -> Bool #

(>=) :: TagSet t -> TagSet t -> Bool #

max :: TagSet t -> TagSet t -> TagSet t #

min :: TagSet t -> TagSet t -> TagSet t #

Ord t => HasTag (TagSet t) t Source # 
Instance details

Defined in EventDataTheory.Core

Methods

hasTag :: TagSet t -> t -> Bool Source #

EventPredicate (TagSet t) t m a Source # 
Instance details

Defined in EventDataTheory.Core

Ord t => From (Set (Tag t)) (TagSet t) Source # 
Instance details

Defined in EventDataTheory.Core

Methods

from :: Set (Tag t) -> TagSet t

Ord t => From (TagSet t) (Set (Tag t)) Source # 
Instance details

Defined in EventDataTheory.Core

Methods

from :: TagSet t -> Set (Tag t)

Ord t => From (TagSet t) [t] Source # 
Instance details

Defined in EventDataTheory.Core

Methods

from :: TagSet t -> [t]

Ord t => From [t] (TagSet t) Source # 
Instance details

Defined in EventDataTheory.Core

Methods

from :: [t] -> TagSet t

(Ord t, Ord t) => From (Interval a) (TagSetInterval t a) Source #

Creates a TagSetInterval from an Interval with empty TagSet.

Instance details

Defined in EventDataTheory.Core

Methods

from :: Interval a -> TagSetInterval t a

Ord t => HasTag (PairedInterval (TagSet t) a) t Source # 
Instance details

Defined in EventDataTheory.Core

Methods

hasTag :: PairedInterval (TagSet t) a -> t -> Bool Source #

Ord a => From (TagSetInterval t a) (Interval a) Source # 
Instance details

Defined in EventDataTheory.Core

Methods

from :: TagSetInterval t a -> Interval a

From (Event t m a) (TagSetInterval t a) Source # 
Instance details

Defined in EventDataTheory.Core

Methods

from :: Event t m a -> TagSetInterval t a

type Rep (TagSet t) Source # 
Instance details

Defined in EventDataTheory.Core

type Rep (TagSet t) = D1 ('MetaData "TagSet" "EventDataTheory.Core" "event-data-theory-0.30.3-inplace" 'True) (C1 ('MetaCons "MkTagSet" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Set (Tag t)))))

data Context t m Source #

A Context contains information about what ocurred during an Events interval. This information is carried in context's tagSet and/or facts. TagSet are set of tags that can be used to identify and filter events using the hasTag function or the related hasAnyTag and hasAllTags functions. The facts field contains data of type m. The m stands for model, meaning the scope and shape of facts relevant to a particular scientific line of work. For example, some studies using health care claims data may be sufficiently different in scope, semanitcs, and aims to warrant having a different collection of facts from, say, electronic medical records data. However, one could create a collection of facts that includes both claims and EHR data. By having a Context parametrized by the shape of a model, users are free to define the structure of their facts as needed.

A context also has a source field, possibly containing a Source, which carries information about the provenance of the data.

Instances

Instances details
Functor (Context t) Source #

The Functor instance of Context t maps over the $sel:getFacts:MkContext field, leaving $sel:getSource:MkContext untouched.

Instance details

Defined in EventDataTheory.Core

Methods

fmap :: (a -> b) -> Context t a -> Context t b #

(<$) :: a -> Context t b -> Context t a #

(Arbitrary m, Arbitrary t, Ord t) => Arbitrary (Context t m) Source #

The Arbitrary instance for Context fixes $sel:getSource:MkContext to Nothing.

Instance details

Defined in EventDataTheory.Core

Methods

arbitrary :: Gen (Context t m)

shrink :: Context t m -> [Context t m]

(Ord t, FromJSON t, FromJSON m) => FromJSON (Context t m) Source # 
Instance details

Defined in EventDataTheory.Core

Methods

parseJSON :: Value -> Parser (Context t m)

parseJSONList :: Value -> Parser [Context t m]

(Ord t, ToJSON t, ToJSON m) => ToJSON (Context t m) Source # 
Instance details

Defined in EventDataTheory.Core

Methods

toJSON :: Context t m -> Value

toEncoding :: Context t m -> Encoding

toJSONList :: [Context t m] -> Value

toEncodingList :: [Context t m] -> Encoding

Generic (Context t m) Source # 
Instance details

Defined in EventDataTheory.Core

Associated Types

type Rep (Context t m) :: Type -> Type #

Methods

from :: Context t m -> Rep (Context t m) x #

to :: Rep (Context t m) x -> Context t m #

(Show t, Show m) => Show (Context t m) Source # 
Instance details

Defined in EventDataTheory.Core

Methods

showsPrec :: Int -> Context t m -> ShowS #

show :: Context t m -> String #

showList :: [Context t m] -> ShowS #

(Binary m, Binary t) => Binary (Context t m) Source # 
Instance details

Defined in EventDataTheory.Core

Methods

put :: Context t m -> Put #

get :: Get (Context t m) #

putList :: [Context t m] -> Put #

(NFData m, NFData t) => NFData (Context t m) Source # 
Instance details

Defined in EventDataTheory.Core

Methods

rnf :: Context t m -> () #

(Eq t, Eq m) => Eq (Context t m) Source # 
Instance details

Defined in EventDataTheory.Core

Methods

(==) :: Context t m -> Context t m -> Bool #

(/=) :: Context t m -> Context t m -> Bool #

Ord t => HasTag (Context t m) t Source # 
Instance details

Defined in EventDataTheory.Core

Methods

hasTag :: Context t m -> t -> Bool Source #

EventPredicate (Context t m) t m a Source # 
Instance details

Defined in EventDataTheory.Core

type Rep (Context t m) Source # 
Instance details

Defined in EventDataTheory.Core

type Rep (Context t m) = D1 ('MetaData "Context" "EventDataTheory.Core" "event-data-theory-0.30.3-inplace" 'False) (C1 ('MetaCons "MkContext" 'PrefixI 'True) (S1 ('MetaSel ('Just "getTagSet") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (TagSet t)) :*: (S1 ('MetaSel ('Just "getFacts") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 m) :*: S1 ('MetaSel ('Just "getSource") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Source)))))

type TagSetInterval t a = PairedInterval (TagSet t) a Source #

A Tag Interval is simply a synonym for an Interval paired with TagSet.

$sel:getFacts:MkContext :: Context t m -> m Source #

the facts of a Context.

context :: TagSet t -> d -> Maybe Source -> Context t d Source #

Smart constructor for a Context,

toTagSet :: Ord t => Set (Tag t) -> TagSet t Source #

Constructor for TagSet.

packTag :: t -> Tag t Source #

Wrap value as a Tag

unpackTag :: Tag t -> t Source #

Unwrap a value from a Tag

packTagSet :: Ord t => [t] -> TagSet t Source #

Put a list of values into a set of tagSet.

unpackTagSet :: Ord t => TagSet t -> [t] Source #

Take a tag set to a list of values.

hasTag :: HasTag a t => a -> t -> Bool Source #

Test whether a type a contains a t.

hasAnyTag :: HasTag a t => a -> [t] -> Bool Source #

Does an a have *any* of a list of Tags?

hasAllTags :: HasTag a t => a -> [t] -> Bool Source #

Does an a have *all* of a list of Tags?

addTagSet :: Ord t => [t] -> TagSet t -> TagSet t Source #

A utility for adding tag sets to a TagSet from a list.

liftToEventPredicate :: EventPredicate element t m a => Predicate element -> Predicate (Event t m a) Source #

Lifts a Predicate of a component of an Event to a Predicate on an Event

liftToEventFunction :: (EventFunction f t t' m m' a a', Ord t, Ord t') => f -> Event t m a -> Event t' m' a' Source #

Lifts a function @@ of a component of an Event to a function on an Event

liftToContextFunction :: (ContextFunction f t t' m m', Ord t, Ord t') => f -> Context t m -> Context t' m' Source #

Lifts a function f of a component of an Context to a function on an Context

bimapContext :: Ord t2 => (t1 -> t2) -> (d1 -> d2) -> Context t1 d1 -> Context t2 d2 Source #

Apply a two functions to a Context:

  1. a function transforming the tagSet
  2. a function transforming the facts

This function is simiilar in flavor to bimap. But Context is not a Bifunctor. The underlying type of TagSet is Set, which is not a Functor because of the Set Ord constraints.

mapTagSet :: Ord t2 => (t1 -> t2) -> TagSet t1 -> TagSet t2 Source #

Apply a function to each Tag within a TagSet set.

NOTE: TagSet are not a Functor. The underlying type of TagSet is Set, which is not a Functor due to the Set Ord constraints.

dropSource :: Context t m -> Context t m Source #

Turn the Source within a Context to Nothing.

type SubjectID = Text Source #

Contains a subject identifier

class HasTag a t Source #

The HasTag typeclass provides predicate functions for determining whether an a contains a tag.

This class is only used in this Core module for the purposes of having a single hasTag function that works on TagSet, Context, or Event data.

Minimal complete definition

hasTag

Instances

Instances details
Ord t => HasTag (TagSet t) t Source # 
Instance details

Defined in EventDataTheory.Core

Methods

hasTag :: TagSet t -> t -> Bool Source #

Ord t => HasTag (Context t m) t Source # 
Instance details

Defined in EventDataTheory.Core

Methods

hasTag :: Context t m -> t -> Bool Source #

Ord t => HasTag (PairedInterval (TagSet t) a) t Source # 
Instance details

Defined in EventDataTheory.Core

Methods

hasTag :: PairedInterval (TagSet t) a -> t -> Bool Source #

Ord t => HasTag (Event t m a) t Source # 
Instance details

Defined in EventDataTheory.Core

Methods

hasTag :: Event t m a -> t -> Bool Source #

class EventPredicate element t m a Source #

Provides a common interface to lift a Predicate e to a Predicate (Event t m a).

For example, if x is a Predicate on some 'Context m t', liftToEventPredicate x yields a Predicate (Event t m a), thus the predicate then also be applied to Events.

This class is only used in this Core module for the purposes of having a single liftToEventPredicate function that works on TagSet, Context, or Event data.

Minimal complete definition

liftToEventPredicate

Instances

Instances details
EventPredicate m t m a Source # 
Instance details

Defined in EventDataTheory.Core

EventPredicate (TagSet t) t m a Source # 
Instance details

Defined in EventDataTheory.Core

EventPredicate (Interval a) t m a Source # 
Instance details

Defined in EventDataTheory.Core

Methods

liftToEventPredicate :: Predicate (Interval a) -> Predicate (Event t m a) Source #

EventPredicate (Maybe Source) t m a Source # 
Instance details

Defined in EventDataTheory.Core

EventPredicate (Context t m) t m a Source # 
Instance details

Defined in EventDataTheory.Core

type Eventable t m a = (Eq m, Ord t, Ord a, Show m, Show t, Show a) Source #

A synonym for a basic set of constraints frequently used with the Event type.

type FromJSONEvent t m a = (FromJSON m, FromJSON t, FromJSON a) Source #

Constraint synonym for FromSON on an event's component types.

type ToJSONEvent t m a = (ToJSON m, ToJSON t, ToJSON a) Source #

Constraint synonym for ToJSON on an event's component types.

Orphan instances

FromJSON a => FromJSON (Interval a) Source # 
Instance details

Methods

parseJSON :: Value -> Parser (Interval a)

parseJSONList :: Value -> Parser [Interval a]

ToJSON a => ToJSON (Interval a) Source # 
Instance details

Methods

toJSON :: Interval a -> Value

toEncoding :: Interval a -> Encoding

toJSONList :: [Interval a] -> Value

toEncodingList :: [Interval a] -> Encoding

(FromJSON b, FromJSON a) => FromJSON (PairedInterval b a) Source # 
Instance details

Methods

parseJSON :: Value -> Parser (PairedInterval b a)

parseJSONList :: Value -> Parser [PairedInterval b a]

(ToJSON b, ToJSON a) => ToJSON (PairedInterval b a) Source # 
Instance details

Methods

toJSON :: PairedInterval b a -> Value

toEncoding :: PairedInterval b a -> Encoding

toJSONList :: [PairedInterval b a] -> Value

toEncodingList :: [PairedInterval b a] -> Encoding