box-0.8.1: boxes
Safe HaskellNone
LanguageHaskell2010

Box.Time

Description

Timing effects.

Synopsis

Documentation

sleep :: MonadConc m => Double -> m () Source #

Sleep for x seconds.

data Stamped a Source #

A value with a UTCTime annotation.

Constructors

Stamped 

Fields

Instances

Instances details
Eq a => Eq (Stamped a) Source # 
Instance details

Defined in Box.Time

Methods

(==) :: Stamped a -> Stamped a -> Bool #

(/=) :: Stamped a -> Stamped a -> Bool #

Read a => Read (Stamped a) Source # 
Instance details

Defined in Box.Time

Show a => Show (Stamped a) Source # 
Instance details

Defined in Box.Time

Methods

showsPrec :: Int -> Stamped a -> ShowS #

show :: Stamped a -> String #

showList :: [Stamped a] -> ShowS #

stampNow :: (MonadConc m, MonadIO m) => a -> m (LocalTime, a) Source #

Add the current time

stampE :: (MonadConc m, MonadIO m) => Emitter m a -> Emitter m (LocalTime, a) Source #

Add the current time stamp.

> process (toListM . stampE) (qList [1..3])
[(2022-02-09 01:18:00.293883,1),(2022-02-09 01:18:00.293899,2),(2022-02-09 01:18:00.293903,3)]

emitIn :: Emitter IO (Double, a) -> Emitter IO a Source #

Wait s seconds before emitting

replay :: Double -> Emitter IO (LocalTime, a) -> CoEmitter IO a Source #

Replay a stamped emitter, adjusting the speed of the replay.

> glueN 4 showStdout $| replay 1 (Emitter $ sleep 0.1 >> Just $ stampNow ())