exceptions-0.3.1: Extensible optionally-pure exceptions

Portabilitynon-portable
Stabilityexperimental
MaintainerEdward Kmett <ekmett@gmail.com>
Safe HaskellTrustworthy

Control.Monad.Catch.Pure

Contents

Description

This module supplies a pure monad transformer that can be used for mock-testing code that throws exceptions, so long as those exceptions are always thrown with throwM.

Do not mix CatchT with IO. Choose one or the other for the bottom of your transformer stack!

Synopsis

Transformer

The transformers-style monad transfomer

newtype CatchT m a Source

Add Exception handling abilities to a Monad.

This should never be used in combination with IO. Think of CatchT as an alternative base monad for use with mocking code that solely throws exceptions via throwM.

Constructors

CatchT 

Fields

runCatchT :: m (Either SomeException a)
 

Instances

mapCatchT :: (m (Either SomeException a) -> n (Either SomeException b)) -> CatchT m a -> CatchT n bSource

Map the unwrapped computation using the given function.

  • runErrorT (mapErrorT f m) = f (runErrorT m)

Typeclass

The mtl style typeclass