Safe Haskell | None |
---|---|
Language | Haskell2010 |
Control.Clock
Description
Pure abstractions for time and clocks.
Synopsis
- data Clock c = Clock {
- clockNow :: !(c Tick)
- clockDelay :: !(TickDelta -> c ())
- clockWith :: !(forall a. c a -> c (Clocked c a))
- clockTimer :: !(forall a. TickDelta -> c a -> c (Either Tick a))
- clockTick :: Monad c => Clock c -> TickDelta -> c Tick
- data Clocked c a = Clocked {
- runClocked :: !(c (Either Tick a))
- finClocked :: !(c ())
- type TickDelta = Word64
- type Tick = Integer
Documentation
A maybe-impure supplier of time, to a pure scheduled computation.
The type c
is the computational context where clock operations occur, e.g. a
Monad
such as IO
.
Clock implementations must be monotonic. See System.Time.Monotonic for an example on how to wrap non-monotonic clocks to be monotonic.
Constructors
Clock | |
Fields
|
See clockWith
for details on what this is for.
Constructors
Clocked | |
Fields
|