[Haskell-cafe] Re: How to reliably open and close resources inMonadIO in the presence of exceptions?

Bayley, Alistair Alistair.Bayley at invesco.com
Fri Oct 16 07:16:52 EDT 2009


> -----Original Message-----
> From: haskell-cafe-bounces at haskell.org 
> [mailto:haskell-cafe-bounces at haskell.org] On Behalf Of Bas van Dijk
> 
> 
> I could of course write a genAlloca if the MonadIO class was extended
> with a bracket method:
> 
> Besides extending MonadIO with bracket, maybe it's also useful to
> extend it with:
> 
> catch :: Exception e => m a -> (e -> m a) -> m a

You might want this library:
http://hackage.haskell.org/packages/archive/MonadCatchIO-transformers/0.
0.1.0/doc/html/Control-Monad-CatchIO.html

There's also an mtl version; not sure which is to be prefered.

Alistair
*****************************************************************
Confidentiality Note: The information contained in this message,
and any attachments, may contain confidential and/or privileged
material. It is intended solely for the person(s) or entity to
which it is addressed. Any review, retransmission, dissemination,
or taking of any action in reliance upon this information by
persons or entities other than the intended recipient(s) is
prohibited. If you received this in error, please contact the
sender and delete the material from any computer.
*****************************************************************



More information about the Haskell-Cafe mailing list