Safe Haskell | Safe-Infered |
---|

Utility functions for MonadPlus operations

- mretryN :: MonadPlus m => Int -> (Int -> m a) -> m a
- retryMaybeN :: Monad m => Int -> (Int -> MaybeT m a) -> m (Maybe a)
- retryErrorN :: MonadError e m => Int -> (Int -> m a) -> m a

# Documentation

mretryN :: MonadPlus m => Int -> (Int -> m a) -> m aSource

Retries the given action up to `n`

times.
The action signals failure by `mzero`

.

retryMaybeN :: Monad m => Int -> (Int -> MaybeT m a) -> m (Maybe a)Source

Retries the given action up to `n`

times.
The action signals failure by `mzero`

.

retryErrorN :: MonadError e m => Int -> (Int -> m a) -> m aSource

Retries the given action up to `n`

times until it succeeds.
If all actions fail, the error of the last one is returned.
The action is always run at least once, even if `n`

is less than 1.