1.1 KiB
1.1 KiB
Exception Handling
MonadError
class Monad m => MonadError e (m :: * -> *) | m -> e where
throwError :: e -> m a
catchError :: m a -> (e -> m a) -> m a
type Except e = ExceptT e Identity
newtype ExceptT e (m :: * -> *) a
= Control.Monad.Trans.Except.ExceptT (m (Either e a))
throwError :: MonadError e m => e -> m a
catchError :: MonadError e m => m a -> (e -> m a) -> m a
runExcept :: Except e a -> Either e a
runExceptT :: ExceptT e m a -> m (Either e a)
Exceptions
class (Typeable e, Show e) => Exception e where
toException :: e -> SomeException
fromException :: SomeException -> Maybe e
GHC.Exception.displayException :: e -> String
throwIO :: (MonadIO m, Exception e) => e -> m a
throwTo :: (MonadIO m, Exception e) => ThreadId -> e -> m ()
throwSTM :: Exception e => e -> STM a
throwError :: MonadError e m => e -> m a
Panic
data FatalError = FatalError {msg :: Text}
panic :: Text -> a