| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Epidemic.Types.Time
Synopsis
- newtype AbsoluteTime = AbsoluteTime Double
- newtype TimeDelta = TimeDelta Double
- newtype Timed a = Timed [(AbsoluteTime, a)]
- timeDelta :: AbsoluteTime -> AbsoluteTime -> TimeDelta
- diracDeltaValue :: Timed a -> AbsoluteTime -> Maybe a
- timeAfterDelta :: AbsoluteTime -> TimeDelta -> AbsoluteTime
- nextTime :: Timed a -> AbsoluteTime -> Maybe AbsoluteTime
- cadlagValue :: Timed a -> AbsoluteTime -> Maybe a
- isAscending :: Ord a => [a] -> Bool
- hasTime :: Timed a -> AbsoluteTime -> Bool
- allTimes :: Timed a -> [AbsoluteTime]
- asTimed :: Num a => [(AbsoluteTime, a)] -> Maybe (Timed a)
Documentation
newtype AbsoluteTime Source #
Absolute time.
Constructors
| AbsoluteTime Double |
Instances
Duration of time between two absolute times.
Instances
| Eq TimeDelta Source # | |
| Ord TimeDelta Source # | |
| Show TimeDelta Source # | |
| Generic TimeDelta Source # | |
| ToJSON TimeDelta Source # | |
Defined in Epidemic.Types.Time | |
| FromJSON TimeDelta Source # | |
| type Rep TimeDelta Source # | |
Defined in Epidemic.Types.Time | |
Type containing values at times. The times are increasing as required by
asTimed.
Constructors
| Timed [(AbsoluteTime, a)] |
Instances
| Eq a => Eq (Timed a) Source # | |
| Show a => Show (Timed a) Source # | |
| Generic (Timed a) Source # | |
| Semigroup (Timed a) Source # | |
| ToJSON a => ToJSON (Timed a) Source # | |
Defined in Epidemic.Types.Time | |
| FromJSON a => FromJSON (Timed a) Source # | |
| type Rep (Timed a) Source # | |
Defined in Epidemic.Types.Time type Rep (Timed a) = D1 ('MetaData "Timed" "Epidemic.Types.Time" "epi-sim-0.4.2-4l1mCHWa7vKLa54bgYWgDR" 'True) (C1 ('MetaCons "Timed" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [(AbsoluteTime, a)]))) | |
Arguments
| :: AbsoluteTime | start |
| -> AbsoluteTime | finish |
| -> TimeDelta |
The duration of time between two absolute times
>>>timeDelta (AbsoluteTime 1) (AbsoluteTime 2.5)TimeDelta 1.5
diracDeltaValue :: Timed a -> AbsoluteTime -> Maybe a Source #
Evaluate the timed object treating it as a direct delta function
timeAfterDelta :: AbsoluteTime -> TimeDelta -> AbsoluteTime Source #
The time after a given delay
>>>timeAfterDelta (AbsoluteTime 1) (TimeDelta 2.5)AbsoluteTime 3.5
nextTime :: Timed a -> AbsoluteTime -> Maybe AbsoluteTime Source #
Return the value of the next time if possible or an exact match if it exists.
cadlagValue :: Timed a -> AbsoluteTime -> Maybe a Source #
Evaluate the timed object treating it as a cadlag function
isAscending :: Ord a => [a] -> Bool Source #
Predicate to check if a list of orderable objects is in ascending order.
hasTime :: Timed a -> AbsoluteTime -> Bool Source #
Check if there exists a pair with a particular time index.
allTimes :: Timed a -> [AbsoluteTime] Source #
Return a list of the (finite) absolute times that the step function changes value.
>>>let demoMaybeTimed = asTimed [(AbsoluteTime 1,2),(AbsoluteTime 1.5,1)]>>>liftM allTimes demoMaybeTimedJust [AbsoluteTime 1.0,AbsoluteTime 1.5]