darcs-2.16.1: a distributed, interactive, smart revision control system

Safe HaskellNone




firstJustIO :: [IO (Maybe a)] -> IO (Maybe a) Source #

The firstJustIO is a slight modification to firstJustM: the entries in the list must be IO monad operations and the firstJustIO will silently turn any monad call that throws an exception into Nothing, basically causing it to be ignored.

catchall :: IO a -> IO a -> IO a Source #

catchNonExistence :: IO a -> a -> IO a Source #

die :: String -> IO a Source #

Terminate the program with an error message.

handleOnly :: Exception e => (e -> Bool) -> IO a -> IO a -> IO a Source #

Handle only a those exceptions for which the predicate succeeds.

handleOnlyIOError :: IO a -> IO a -> IO a Source #

Handle only actual IO exceptions i.e. not "user errors" e.g. those raised by calling fail.

We use fail all over the place to signify erroneous conditions and we normally don't want to handle such errors.

ifIOError :: a -> IO a -> IO a Source #

Like handleOnlyIOError but restricted to returning a given value.

ifDoesNotExistError :: a -> IO a -> IO a Source #

Like ifIOError but restricted to handling non-existence.