| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Serokell.Util.Exceptions
Contents
Description
Bitgram's general-purpose exceptions. They may be useful when you need a simple instance of Exception (e. g. in MonadThrow context)
Synopsis
- newtype TextException = TextException {}
- throwText :: MonadThrow m => Text -> m a
- data EmptyException = EmptyException
- throwEmpty :: MonadThrow m => m a
- eitherToFail :: (Monad m, e ~ SomeException) => Either e a -> m a
Documentation
newtype TextException Source #
Use this type if you are sure that text description is enough to represent error
Constructors
| TextException | |
Instances
| Show TextException Source # | |
Defined in Serokell.Util.Exceptions Methods showsPrec :: Int -> TextException -> ShowS # show :: TextException -> String # showList :: [TextException] -> ShowS # | |
| Exception TextException Source # | |
Defined in Serokell.Util.Exceptions Methods toException :: TextException -> SomeException # fromException :: SomeException -> Maybe TextException # displayException :: TextException -> String # | |
| Buildable TextException Source # | |
Defined in Serokell.Util.Exceptions Methods build :: TextException -> Builder # | |
throwText :: MonadThrow m => Text -> m a Source #
data EmptyException Source #
Use this type if you want to signal about error and there may be only one reason for it
Constructors
| EmptyException |
Instances
| Show EmptyException Source # | |
Defined in Serokell.Util.Exceptions Methods showsPrec :: Int -> EmptyException -> ShowS # show :: EmptyException -> String # showList :: [EmptyException] -> ShowS # | |
| Exception EmptyException Source # | |
Defined in Serokell.Util.Exceptions Methods toException :: EmptyException -> SomeException # | |
throwEmpty :: MonadThrow m => m a Source #
eitherToFail :: (Monad m, e ~ SomeException) => Either e a -> m a Source #
Convert MonadThrow to arbitrary monad using fail to report
error Useful when you have MonadThrow and want to use it in
another monad context which uses fail for errors
Orphan instances
| Buildable SomeException Source # | |
Methods build :: SomeException -> Builder # | |