auto-update-unliftio-0.1.0.0: auto-update unlifted to MonadUnliftIO
Safe HaskellSafe-Inferred
LanguageHaskell2010

UnliftIO.AutoUpdate.Internal

Contents

Synopsis

Debugging

mkClosableAutoUpdate :: MonadUnliftIO m => UpdateSettings m a -> m (m a, m ()) 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' :: MonadUnliftIO m => UpdateSettings m a -> m (m a, m (), UpdateState m a) Source #

provide UpdateState for debugging