Copyright | (c) 2012 Leon P Smith (c) 2012-2013 Janne Hellsten |
---|---|
License | BSD3 |
Maintainer | Janne Hellsten <jjhellst@gmail.com> |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
The Ok
type is a simple error handler, basically equivalent to
Either [SomeException]
.
One of the primary reasons why this type was introduced is that
Either SomeException
had not been provided an instance for Alternative
,
and it would have been a bad idea to provide an orphaned instance for a
commonly-used type and typeclass included in base
.
Extending the failure case to a list of SomeException
s enables a
more sensible Alternative
instance definitions: <|>
concatinates
the list of exceptions when both cases fail, and empty
is defined as
'Errors []'. Though <|>
one could pick one of two exceptions, and
throw away the other, and have empty
provide a generic exception,
this avoids cases where empty
overrides a more informative exception
and allows you to see all the different ways your computation has failed.
Synopsis
- data Ok a
- = Errors [SomeException]
- | Ok !a
- newtype ManyErrors = ManyErrors [SomeException]
Documentation
Errors [SomeException] | |
Ok !a |
Instances
Monad Ok Source # | |
Functor Ok Source # | |
MonadFail Ok Source # | |
Defined in Database.SQLite.Simple.Ok | |
Applicative Ok Source # | |
Alternative Ok Source # | |
MonadPlus Ok Source # | |
Eq a => Eq (Ok a) Source # | Two |
Show a => Show (Ok a) Source # | |
newtype ManyErrors Source #
a way to reify a list of exceptions into a single exception
Instances
Show ManyErrors Source # | |
Defined in Database.SQLite.Simple.Ok showsPrec :: Int -> ManyErrors -> ShowS # show :: ManyErrors -> String # showList :: [ManyErrors] -> ShowS # | |
Exception ManyErrors Source # | |
Defined in Database.SQLite.Simple.Ok toException :: ManyErrors -> SomeException # fromException :: SomeException -> Maybe ManyErrors # displayException :: ManyErrors -> String # |