polysemy-time-0.6.0.0: Polysemy effects for time
Safe HaskellSafe-Inferred
LanguageHaskell2010

Polysemy.Time.At

Description

Interceptors for fixing a specific time, Internal

Synopsis

Documentation

dateCurrentRelative :: forall diff t d r. Torsor t diff => Members [Time t d, AtomicState (t, t)] r => Sem r t Source #

Determine the current time adjusted for the difference between a custom instant and the time at which the program was started.

interceptTimeAtWithStart :: forall diff t d r a. Torsor t diff => TimeUnit diff => HasDate t d => Members [Time t d, AtomicState (t, t)] r => Sem r a -> Sem r a Source #

Given real and adjusted start time, change all calls to Now and Today to be relative to that start time. This needs to be interpreted with a vanilla interpreter for Time once more.

interceptTimeAt :: forall (diff :: Type) t d r a. TimeUnit diff => Torsor t diff => HasDate t d => Members [Time t d, Embed IO] r => t -> Sem r a -> Sem r a Source #

Interpret Time so that the time when the program starts is startAt.

interceptTimeConstantState :: forall t d diff r a. Ord diff => HasDate t d => TimeUnit diff => Torsor t diff => Members [Time t d, AtomicState t] r => Sem r a -> Sem r a Source #

Change all calls to Now and Today to return the given start time. This needs to be interpreted with a vanilla interpreter for Time once more.

interceptTimeConstant :: forall t d diff r a. Ord diff => HasDate t d => TimeUnit diff => Torsor t diff => Members [Time t d, Embed IO] r => t -> Sem r a -> Sem r a Source #

Interpret Time so that the time is always startAt.

The time can still be changed with setTime, adjust and setDate. Sleeping will only terminate after the time has been advanced by adjust.

interceptTimeConstantNow :: forall t d diff r a. Ord diff => HasDate t d => TimeUnit diff => Torsor t diff => Members [Time t d, Embed IO] r => Sem r a -> Sem r a Source #

Interpret Time so that the time is always the time at the start of interpretation.

The time can still be changed with setTime, adjust and setDate. Sleeping will only terminate after the time has been advanced by adjust.