[Haskell-cafe] Re: Strictness, order of IO operations: NewCGI & HDBC

Tim Smith trangayesi at gmail.com
Sun Oct 22 04:49:38 EDT 2006


Oleg,

On 10/20/06, oleg at pobox.com <oleg at pobox.com> wrote:
>
> Tim Smith wrote:
> > Has anyone found out how to lift bracket into another monad?
>
> Yes, please see the thread `Re: Control.Exceptions and MonadIO'
> staring at
>   http://www.haskell.org/pipermail/haskell-cafe/2006-April/015444.html

That's just what I needed.  I think it would have taken me 3 years to
figure out that solution on my own.

instance CaughtMonadIO m => CaughtMonadIO (CGIT m) where
  gcatch a handler = CGIT $ gcatch (unCGIT a) (\e -> unCGIT (handler e))

That, plus an instance declaration for WriterT, makes it work!  Using
gbracket, along with deepSeq when needed, should improve the structure
of the program a lot.  I hope Haskell' gets something like this
accepted.

And, thanks again to John G. and others who chimed in on this - it's
much appreciated.

Thank you,

Tim
-- 
If you're not part of the solution, you're part of the precipitate.


More information about the Haskell-Cafe mailing list