Safe Haskell | None |
---|---|
Language | Haskell2010 |
- data RefreshT s m a
- runRefreshT :: MonadCatch m => RefreshSetting s m -> s -> RefreshT s m a -> m (a, s)
- evalRefreshT :: MonadCatch m => RefreshSetting s m -> s -> RefreshT s m a -> m a
- data RefreshSetting s m
- defaultRefreshSetting :: Monad m => RefreshSetting s m
- refresher :: forall s m. Lens' (RefreshSetting s m) (s -> m s)
- refreshDelay :: forall s m. Lens' (RefreshSetting s m) Int
- shouldRefresh :: forall s m. Lens' (RefreshSetting s m) (s -> m Bool)
- isRefreshingError :: forall s m. Lens' (RefreshSetting s m) (SomeException -> Bool)
- atomic :: (MonadIO m, MonadCatch m) => RefreshT s m a -> RefreshT s m a
- atomicLift :: (MonadIO m, MonadCatch m) => m a -> RefreshT s m a
- atomicLiftIO :: (MonadIO m, MonadCatch m) => IO a -> RefreshT s m a
- withEnv :: (MonadIO m, MonadCatch m) => (s -> m a) -> RefreshT s m a
- refresh :: MonadIO m => RefreshT s m ()
RefreshT
type and settings
RefreshT
Reader monad transformer with an automatic environment refreshment.
Since 0.1.0.0
MonadIO m => MonadReader s (RefreshT s m) Source # | N.B. The refreshed result took place inside Since 0.1.0.0 |
MonadTrans (RefreshT s) Source # | N.B. The Since 0.1.0.0 |
Monad m => Monad (RefreshT s m) Source # | |
Functor m => Functor (RefreshT s m) Source # | |
Monad m => Applicative (RefreshT s m) Source # | |
MonadIO m => MonadIO (RefreshT s m) Source # | N.B. The Since 0.1.0.0 |
MonadThrow m => MonadThrow (RefreshT s m) Source # | Since 0.1.1.0 |
MonadCatch m => MonadCatch (RefreshT s m) Source # | N.B. When exception is |
runRefreshT :: MonadCatch m => RefreshSetting s m -> s -> RefreshT s m a -> m (a, s) Source #
Excecute environmental computation and returns the result with the final environment.
Since 0.1.0.0
evalRefreshT :: MonadCatch m => RefreshSetting s m -> s -> RefreshT s m a -> m a Source #
Excecute environmental computation and returns the result, discarding the final environment.
Since 0.1.0.0
Settings for Refreshing
data RefreshSetting s m Source #
Settings for Refreshment
Since 0.1.0.0
Monad m => Default (RefreshSetting s m) Source # | Since 0.1.0.0 |
defaultRefreshSetting :: Monad m => RefreshSetting s m Source #
refresher :: forall s m. Lens' (RefreshSetting s m) (s -> m s) Source #
Environment refreshing function (default: return
).
Since 0.1.0.0
refreshDelay :: forall s m. Lens' (RefreshSetting s m) Int Source #
Delay in microseconds before environmental refreshment (default: 100ms
).
Since 0.1.0.0
shouldRefresh :: forall s m. Lens' (RefreshSetting s m) (s -> m Bool) Source #
Condition to determine if environment should be refreshed (default: const True
).
Since 0.1.0.0
isRefreshingError :: forall s m. Lens' (RefreshSetting s m) (SomeException -> Bool) Source #
If this exception should occur an envionment refreshment? (default: refresh for any exception).
Since 0.1.0.0
Transaction Combinators
atomic :: (MonadIO m, MonadCatch m) => RefreshT s m a -> RefreshT s m a Source #
Try an atomic transaction and,
if exceptions specified by
has been raised,
refreshes the environment and redo the entire transaction.isRefreshingError
Since 0.1.0.0
atomicLift :: (MonadIO m, MonadCatch m) => m a -> RefreshT s m a Source #
.atomicLift
= atomic
. lift
Since 0.1.0.0
atomicLiftIO :: (MonadIO m, MonadCatch m) => IO a -> RefreshT s m a Source #
.atomicLiftIO
= atomic
. liftIO
Since 0.1.0.0
withEnv :: (MonadIO m, MonadCatch m) => (s -> m a) -> RefreshT s m a Source #
composed with atomicLift
.ask
Since 0.1.0.0