- type Answer a = Either SomeException a
- done :: Monad m => m ()
- (#) :: a -> (a -> b) -> b
- propagate :: Answer a -> IO a
- try :: Exception e => IO a -> IO (Either e a)
- tryUntilOK :: IO a -> IO a
- raise :: IOError -> IO a
- when :: Monad m => Bool -> m () -> m ()
- unless :: Monad m => Bool -> m () -> m ()
- incase :: Maybe a -> (a -> IO b) -> IO ()
- forever :: Monad m => m a -> m b
- foreverUntil :: Monad m => m Bool -> m ()
- foreach :: Monad m => [a] -> (a -> m b) -> m ()
- while :: Monad m => m a -> (a -> Bool) -> m a
- type Config w = w -> IO w
- configure :: w -> [Config w] -> IO w
- config :: IO () -> Config w
- class HasConfig option configuration where
- ($$) :: option -> configuration -> configuration
- configUsed :: option -> configuration -> Bool
- data WithError a
- hasError :: String -> WithError a
- hasValue :: a -> WithError a
- fromWithError :: WithError a -> Either String a
- fromWithError1 :: a -> WithError a -> a
- toWithError :: Either String a -> WithError a
- isError :: WithError a -> Bool
- mapWithError :: (a -> b) -> WithError a -> WithError b
- mapWithError' :: (a -> WithError b) -> WithError a -> WithError b
- mapWithErrorIO :: (a -> IO b) -> WithError a -> IO (WithError b)
- mapWithErrorIO' :: (a -> IO (WithError b)) -> WithError a -> IO (WithError b)
- pairWithError :: WithError a -> WithError b -> WithError (a, b)
- listWithError :: [WithError a] -> WithError [a]
- coerceWithError :: WithError a -> a
- coerceWithErrorIO :: WithError a -> IO a
- coerceWithErrorStringIO :: String -> WithError a -> IO a
- coerceWithErrorOrBreakIOPrefix :: String -> (String -> a) -> WithError a -> IO a
- coerceWithErrorOrBreakPrefix :: String -> (String -> a) -> WithError a -> a
- newtype MonadWithError m a = MonadWithError (m (WithError a))
- monadifyWithError :: Monad m => WithError a -> MonadWithError m a
- toMonadWithError :: Monad m => m a -> MonadWithError m a
- coerceWithErrorOrBreak :: (String -> a) -> WithError a -> a
- coerceWithErrorOrBreakIO :: (String -> a) -> WithError a -> IO a
- concatWithError :: [WithError a] -> WithError [a]
- swapIOWithError :: WithError (IO a) -> IO (WithError a)
- exceptionToError :: Exception e => (e -> Maybe String) -> IO a -> IO (WithError a)
Documentation
type Answer a = Either SomeException aSource
exceptions and handlers
try :: Exception e => IO a -> IO (Either e a)
Similar to catch
, but returns an Either
result which is
(
if no exception of type Right
a)e
was raised, or (
if an exception of type Left
ex)e
was raised and its value is ex
.
If any other type of exception is raised than it will be propogated
up to the next enclosing exception handler.
try a = catch (Right `liftM` a) (return . Left)
Note that System.IO.Error also exports a function called
System.IO.Error.try
with a similar type to Control.Exception.try
,
except that it catches only the IO and user families of exceptions
(as required by the Haskell 98 IO
module).
tryUntilOK :: IO a -> IO aSource
selectors
when :: Monad m => Bool -> m () -> m ()
Conditional execution of monadic expressions. For example,
when debug (putStr "Debugging\n")
will output the string Debugging\n
if the Boolean value debug
is True
,
and otherwise do nothing.
iterators
foreverUntil :: Monad m => m Bool -> m ()Source
configure command
The new-style configuration command
class HasConfig option configuration whereSource
($$) :: option -> configuration -> configurationSource
configUsed :: option -> configuration -> BoolSource
Returning results or error messages.
fromWithError :: WithError a -> Either String aSource
fromWithError1 :: a -> WithError a -> aSource
toWithError :: Either String a -> WithError aSource
mapWithError :: (a -> b) -> WithError a -> WithError bSource
mapWithError' :: (a -> WithError b) -> WithError a -> WithError bSource
pairWithError :: WithError a -> WithError b -> WithError (a, b)Source
listWithError :: [WithError a] -> WithError [a]Source
coerceWithError :: WithError a -> aSource
coerceWithErrorIO :: WithError a -> IO aSource
coerceWithErrorStringIO :: String -> WithError a -> IO aSource
coerceWithErrorOrBreakIOPrefix :: String -> (String -> a) -> WithError a -> IO aSource
coerce or use the supplied break function (to be used with
ExtendedPrelude.addFallOut
)
The first argument is prepended to any error message. The value is evaluated immediately.
coerceWithErrorOrBreakPrefix :: String -> (String -> a) -> WithError a -> aSource
coerce or use the supplied break function (to be used with
ExtendedPrelude.addFallOut
)
The first argument is prepended to any error message.
newtype MonadWithError m a Source
MonadWithError (m (WithError a)) |
Monad m => Monad (MonadWithError m) |
monadifyWithError :: Monad m => WithError a -> MonadWithError m aSource
toMonadWithError :: Monad m => m a -> MonadWithError m aSource
coerceWithErrorOrBreak :: (String -> a) -> WithError a -> aSource
coerce or use the supplied break function (to be used with
ExtendedPrelude.addFallOut
)
coerceWithErrorOrBreakIO :: (String -> a) -> WithError a -> IO aSource
coerce or use the supplied break function (to be used with
ExtendedPrelude.addFallOut
)
The value is evaluated immediately.
concatWithError :: [WithError a] -> WithError [a]Source