Safe Haskell | None |
---|---|
Language | Haskell2010 |
You can use the Arrow instance to get different types of ticker time. Eg:
diffTimeEvery :: MonadIO io => C.Clock -> Int -> P.Producer' C.TimeSpec io r diffTimeEvery clock micros = always () P.>-> delay micros P.>-> ticker clock P.>-> diffTime import Control.Arrow import qualified Control.Category as Cat import qualified Pipes.Shaft as PS diffAndTickEvery :: MonadIO io => C.Clock -> Int -> P.Producer' (C.TimeSpec, C.TimeSpec) io r diffAndTickEvery clock micros = always () P.>-> delay micros P.>-> ticker clock P.>-> PS.fromShaft (PS.Shaft diffTime &&& Cat.id)
Documentation
delay' :: MonadIO io => Int -> Pipe a a io r Source #
After the first await, add a delay after every subsequent await.
ticker :: MonadIO io => Clock -> Pipe () TimeSpec io r Source #
Continuously yield the clock time Use with delay to reduce the yield rate. Eg:
tickEvery :: MonadIO io => C.Clock -> Int -> P.Producer' C.TimeSpec io r tickEvery clock micros = always () P.>-> delay micros P.>-> ticker clock