monad-wrap: Wrap functions such as catch around different monads
This package allows you to invoke a function on one monadic
type passing it an argument of a different monadic type. The
canonical example of this is wanting to use a function such as
to catch exceptions thrown by
a computation finally
:: IO
a -> IO
ax ::
. If ReaderT
MyConfig IO
bx
uses
the ReaderT
function ask
, it cannot be re-written to run
in the IO
monad, and hence cannot be executed with a
construction like
.
Instead, you must use the lift
(x `finally`
cleanup)wrap
method, provide by module
Control.Monad.Wrap. This package contains two further
modules: Control.Monad.MultiWrap implements mwrap
, a
method that behaves like wrap
but allows wrapping through
multiple nested layers of monad transformer. The module
Control.Monad.MultiLift provides mlift
, a version of
lift
that similarly lifts through multiple nested monad
transformers.
Downloads
- monad-wrap-0.0.tar.gz [browse] (Cabal source package)
- Package description (as included in the package)
Maintainer's Corner
For package maintainers and hackage trustees
Candidates
- No Candidates
Versions [RSS] | 0.0, 0.1 |
---|---|
Dependencies | base (>=4 && <5), mtl (>=1.1.0.2 && <2) [details] |
License | BSD-3-Clause |
Author | David Mazieres |
Maintainer | http://www.scs.stanford.edu/~dm/addr/ |
Category | Control |
Uploaded | by DavidMazieres at 2009-10-17T22:11:52Z |
Distributions | |
Reverse Dependencies | 1 direct, 0 indirect [details] |
Downloads | 1928 total (0 in the last 30 days) |
Rating | (no votes yet) [estimated by Bayesian average] |
Your Rating | |
Status | Docs uploaded by user Build status unknown [no reports yet] |