Safe Haskell | Safe-Inferred |
---|
In many error-checking algorithms, it is desireable to report several errors rather than simply terminate on detecting the first error.
Where Either
and Error
terminates on the first error, Errors
can
recover at specified points and continue error-checking. Even after a
recovery, the prior errors are logged. If any errors occured during
error-checking, this si an error in the whole computation.
- type Errors e = ErrorsT e Identity
- runErrors :: Monoid e => Errors e a -> Either e a
- err :: (Monad m, Monoid e) => e -> ErrorsT e m a
- err1 :: Monad m => e -> ErrorsT [e] m a
- choice :: (Monad m, Monoid e) => e -> [ErrorsT e m a] -> ErrorsT e m a
- recover :: (Monad m, Monoid e) => a -> ErrorsT e m a -> ErrorsT e m a
- recover_ :: (Monad m, Monoid e) => ErrorsT e m a -> ErrorsT e m ()
- mapRecover :: (Monad m, Monoid e) => [ErrorsT e m a] -> ErrorsT e m [Maybe a]
- unrecover :: (Monad m, Monoid e) => ErrorsT e m ()
- hoistMaybe :: (Monad m, Monoid e) => e -> Maybe a -> ErrorsT e m a
- hoistEither :: (Monad m, Monoid e) => Either e a -> ErrorsT e m a
- hoistEither1 :: Monad m => Either e a -> ErrorsT [e] m a
- data ErrorsT e m a
- runErrorsT :: (Monad m, Monoid e) => ErrorsT e m a -> m (Either e a)
Errors Monad
Error Reporting Functions
choice :: (Monad m, Monoid e) => e -> [ErrorsT e m a] -> ErrorsT e m aSource
Try several alternatives (in order), but if none succeed, raise the passed error.
recover :: (Monad m, Monoid e) => a -> ErrorsT e m a -> ErrorsT e m aSource
If the action returns an error, relpace the result with a default. The error is still logged and reported at the end of the computation.
recover_ :: (Monad m, Monoid e) => ErrorsT e m a -> ErrorsT e m ()Source
As recover
, but any successful result value does not matter.
unrecover :: (Monad m, Monoid e) => ErrorsT e m ()Source
If any errors have been detected, cuase them to be loud again.
Hoisting Functions
hoistEither1 :: Monad m => Either e a -> ErrorsT [e] m aSource
Errors Transformer
Computations that can collect multiple errors.