[reactive] Re: black hole detection and concurrency
ml at isaac.cedarswampstudios.org
Sun Jan 4 19:40:38 EST 2009
therefore mapException is equally buggy!
> mapException :: (Exception e1, Exception e2) => (e1 -> e2) -> a -> a
> mapException f v = unsafePerformIO (catch (evaluate v)
> (\x -> throw (f x)))
If it maps an asynchronous exception.. and it's re-thrown as
synchronous... the same non-resumability happens!
mapException is a particular culprit because of the
unsafePerformIO (so you had a good reason to expect
resumability, since it's for a pure computation, not in IO)
- does anyone use mapException?
- is there some reason that we don't have all "throw"s
(synch. or asynch.) "patch up" the thunks? (memory leaks or
serious inefficiency or something?)
if "yes", I don't think mapException can currently be
implemented; we'd need some way in its "catch" to detect
whether the thrown exception was asynchronous, and *iff* so,
throw the new exception asynchronously (if synchronous,
rethrow synchronously). Or some equivalent. Or maybe some
add some magic to unsafePerformIO (probably a bad idea).
More information about the Glasgow-haskell-users