[Haskell-cafe] Installing a top-level handler on an existing thread

Leon Smith leon.p.smith at gmail.com
Mon Jan 24 14:02:38 CET 2011

I've been toying with a little thread manager library,  and for
sanity's sake I really need a way to install another top-level
exception handler on an existing thread.    I don't want to replace
any other handlers,  just put my own handler around the thread's
continuation.   Of course,  it would be pretty easy to do if the IO
monad had a nice efficient implementation of call/cc and call/cc1,
although I don't need the full power of continuations.

I really don't want to create my own "Thread" monad (which could use
ContT),  I want to be able to do it on plain old IO threads.   Is
there any way to do this in GHC?


More information about the Haskell-Cafe mailing list