-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A useful type for collecting error messages. -- -- A useful type for collecting error messages. @package error-list @version 0.1.0.2 module Control.Exception.ErrorList class IsList elist => ErrorList elist addError :: ErrorList elist => Text -> elist -> elist oneError :: ErrorList elist => Text -> elist data EList EList :: Text -> [Text] -> EList -- | Throws a single-message eror list. throwError1 :: (ErrorList e, MonadError e m) => Text -> m a -- | Concatenates a list of strings and throws them as an error. throwErrorC :: (ErrorList e, MonadError e m) => [Text] -> m a -- | Throws a new error with the given string added on. addError1 :: (ErrorList e, MonadError e m) => Text -> e -> m a -- | Throws a new error with the concatenation of the argument added on. addErrorC :: (ErrorList e, MonadError e m) => [Text] -> e -> m a -- | If the test is false, throws an error with the given message. assert :: (ErrorList e, MonadError e m) => Bool -> Text -> m () -- | Same as assert, but concatenates a text list. assertC :: (ErrorList e, MonadError e m) => Bool -> [Text] -> m () -- | Wraps a successful result in a Just and a failure in a -- Nothing. wrapJust :: MonadError e m => m a -> m (Maybe a) -- | Useful when the handler is more concise than the action. withHandler :: MonadError e m => (e -> m a) -> m a -> m a -- | Specifies what to do if the given action fails. ifErrorDo :: MonadError e m => m a -> m a -> m a -- | Performs an action, returning the second argument if it fails. ifErrorReturn :: MonadError e m => m a -> a -> m a -- | Pretty-prints errors that use Either. showError :: (Render e, Render b) => (a -> Either e b) -> a -> IO () -- | Pretty-prints errors that use Either, appearing in tuples. showError' :: (Render e, Render b) => (a -> (Either e b, c)) -> a -> IO () -- | Concatenates a list of Text and makes an error out of it. errorC :: [Text] -> a -- | Pretty-prints an error list. Considers the first item of the list to -- be the "main" message; subsequent messages are listed after. -- printErrors :: ErrorList e => e -> IO () printErrors (ErrorList -- err errs) = do P.putStrLn ("Error: " <> unpack err) P.mapM_ -- (P.putStrLn . unpack . (" " <>)) errs -- -- Same as oneError but concatenates its argument. oneErrorC :: ErrorList e => [Text] -> e firstSuccess :: (ErrorList e, MonadError e m) => Text -> [m a] -> m a -- | Tries something and throws an error if it fails. inContext :: (ErrorList e, MonadError e m) => Text -> m a -> m a instance GHC.Classes.Eq Control.Exception.ErrorList.EList instance GHC.Show.Show Control.Exception.ErrorList.EList instance GHC.Exts.IsList Control.Exception.ErrorList.EList instance Control.Exception.ErrorList.ErrorList Control.Exception.ErrorList.EList instance Text.Render.Render Control.Exception.ErrorList.EList