lio-0.0.1: Labeled IO library

LIO.MonadCatch

Description

This module generalizes throw and catch (from Control.Exception) to methods that can be defined on multiple Monads.

Synopsis

Documentation

class Monad m => MonadCatch m whereSource

MonadCatch is the class used to generalize the standard IO catch and throwIO functions to methods that can be defined in multiple monads.

Methods

block :: m a -> m aSource

unblock :: m a -> m aSource

throwIO :: Exception e => e -> m aSource

catch :: Exception e => m a -> (e -> m a) -> m aSource

handle :: Exception e => (e -> m a) -> m a -> m aSource

onException :: m a -> m b -> m aSource

bracket :: m b -> (b -> m c) -> (b -> m a) -> m aSource

Instances

genericBracketSource

Arguments

:: MonadCatch m 
=> (m b -> m c -> m b)

On exception function

-> m a

Action to perform before

-> (a -> m c)

Action for afterwards

-> (a -> m b)

Main (in between) action

-> m b

Result of main action