Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data BackgroundVal a
- type MicroSeconds n = n
- background :: Tracer IO (Track a) -> b -> a -> (b -> IO (a, b)) -> IO (BackgroundVal a)
- backgroundLoop :: Tracer IO (Track a) -> a -> IO a -> MicroSeconds Int -> IO (BackgroundVal a)
- kill :: (HasCallStack, MonadIO m) => BackgroundVal a -> m ()
- link :: BackgroundVal a -> BackgroundVal b -> IO ()
- readBackgroundVal :: MonadIO m => BackgroundVal a -> m a
- data Track r
Documentation
data BackgroundVal a Source #
A value that is coupled to an async in charge of updating the value.
Instances
Functor BackgroundVal Source # | |
Defined in Prod.Background fmap :: (a -> b) -> BackgroundVal a -> BackgroundVal b # (<$) :: a -> BackgroundVal b -> BackgroundVal a # |
type MicroSeconds n = n Source #
Fantom type for annotating Int.
:: Tracer IO (Track a) | |
-> b | initial state |
-> a | initial value |
-> (b -> IO (a, b)) | state-influenced task |
-> IO (BackgroundVal a) |
Starts a background task continuously updating a value.
:: Tracer IO (Track a) | |
-> a | initial value |
-> IO a | periodic task |
-> MicroSeconds Int | wait period between two executions |
-> IO (BackgroundVal a) |
Starts a background task continuously updating a value at a periodic interval. This is implemented by interspersing a threadDelay before the task and calling background and hiding the 'state-passing' arguments.
kill :: (HasCallStack, MonadIO m) => BackgroundVal a -> m () Source #
Kills the watchdog by killing the underlying async.
link :: BackgroundVal a -> BackgroundVal b -> IO () Source #
readBackgroundVal :: MonadIO m => BackgroundVal a -> m a Source #
Kills the watchdog by killing the underlying async.