auto-update-0.2.6: Efficiently run periodic, on-demand actions
Safe HaskellSafe-Inferred
LanguageHaskell2010

Control.AutoUpdate.Internal

Contents

Synopsis

Debugging

mkClosableAutoUpdate :: UpdateSettings a -> IO (IO a, IO ()) Source #

>>> iref <- newIORef (0 :: Int)
>>> action = modifyIORef iref (+ 1) >> readIORef iref
>>> (getValue, closeState) <- mkClosableAutoUpdate $ defaultUpdateSettings { updateFreq = 200_000, updateAction = action }
>>> getValue
1
>>> threadDelay 100_000 >> getValue
1
>>> threadDelay 200_000 >> getValue
2
>>> closeState

mkClosableAutoUpdate' :: UpdateSettings a -> IO (IO a, IO (), UpdateState a) Source #

provide UpdateState for debugging