Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Timing effects.
Synopsis
- sleep :: Double -> IO ()
- stampNow :: a -> IO (LocalTime, a)
- stampE :: Emitter IO a -> Emitter IO (LocalTime, a)
- type Gap = Double
- gaps :: Emitter IO (LocalTime, a) -> CoEmitter IO (Gap, a)
- fromGaps :: LocalTime -> Emitter IO (Gap, a) -> CoEmitter IO (LocalTime, a)
- fromGapsNow :: Emitter IO (Gap, a) -> CoEmitter IO (LocalTime, a)
- gapEffect :: Emitter IO (Gap, a) -> Emitter IO a
- skip :: Int -> Emitter IO (Gap, a) -> CoEmitter IO (Gap, a)
- replay :: Double -> Int -> Emitter IO (LocalTime, a) -> CoEmitter IO a
- gapSkipEffect :: Emitter IO Int -> Emitter IO Gap -> CoEmitter IO Gap
- speedEffect :: Emitter IO Gap -> Emitter IO (Gap, a) -> Emitter IO a
- speedSkipEffect :: Emitter IO (Int, Gap) -> Emitter IO (Gap, a) -> CoEmitter IO a
Documentation
stampE :: Emitter IO a -> Emitter IO (LocalTime, a) Source #
Add the current time stamp.
> toListM . stampE $| (qList [1..3]) [(2022-08-30 01:55:16.517127,1),(2022-08-30 01:55:16.517132,2),(2022-08-30 01:55:16.517135,3)]
gaps :: Emitter IO (LocalTime, a) -> CoEmitter IO (Gap, a) Source #
Convert stamped emitter to gap between emits in seconds
toListM <$|> (gaps =<< (fromGapsNow =<< (qList (zip (0:repeat 1) [1..4])))) [(0.0,1),(1.0,2),(1.0,3),(1.0,4)]
fromGaps :: LocalTime -> Emitter IO (Gap, a) -> CoEmitter IO (LocalTime, a) Source #
Convert gaps in seconds to stamps starting from an initial supplied LocalTime
fromGapsNow :: Emitter IO (Gap, a) -> CoEmitter IO (LocalTime, a) Source #
Convert gaps in seconds to stamps starting with current time
toListM <$|> (fromGapsNow =<< (qList (zip (0:repeat 1) [1..4]))) [(2022-08-30 22:57:33.835228,1),(2022-08-30 22:57:34.835228,2),(2022-08-30 22:57:35.835228,3),(2022-08-30 22:57:36.835228,4)]
gapEffect :: Emitter IO (Gap, a) -> Emitter IO a Source #
Convert a (Gap,a) emitter to an a emitter, with delays between emits of the gap.
skip :: Int -> Emitter IO (Gap, a) -> CoEmitter IO (Gap, a) Source #
Ignore the first n gaps and immediately emit them.
replay :: Double -> Int -> Emitter IO (LocalTime, a) -> CoEmitter IO a Source #
Replay a stamped emitter, adjusting the speed of the replay.
toListM . stampE <$|> (replay 0.1 1 =<< (fromGapsNow =<< (qList (zip (0:repeat 1) [1..4])))) [(2022-08-31 02:29:39.643831,1),(2022-08-31 02:29:39.643841,2),(2022-08-31 02:29:39.746998,3),(2022-08-31 02:29:39.849615,4)]
gapSkipEffect :: Emitter IO Int -> Emitter IO Gap -> CoEmitter IO Gap Source #
Only add a Gap effect if greater than the Int emitter
effect is similar to a fast-forward of the first n emits