-
Notifications
You must be signed in to change notification settings - Fork 1
What is story for catches
#1
Comments
Interesting question! I'm not sure. Note that in a world where all exceptions are checked, the concern that one handler might catch another's exception can be mitigated by reordering them (at least in some cases). For example, say we have x :: (Throws Foo, Throws Bar) => IO ()
f :: Throws Bar => Foo -> IO ()
g :: Bar -> IO () If we write x `catch` f `catch` g then But if instead we write x `catch` g `catch` f then we're happily left with a By the way, I've personally never used this library, as the idea seems fundamentally flawed in many ways that were not evident to me after reading the Well Typed blog post. For example, consider bomb :: Throws Bomb => IO ()
forkIO bomb :: Throws Bomb => IO ThreadId Oops, the calling thread got stuck with having to discharge the constraint, which is clearly wrong (though the I'm eager to hear if you are having any success with this library, as the concept is, in theory, very valuable. But at the moment I've just been embracing the unchecked, extensible exception hierarchy, and at times wishing there was a decent alternative design (or at least that there was more of a cultural emphasis on extensively documenting exactly what the exception hierarchy that ships with your library is, ascii-tree diagrams and all, plus exactly which functions might throw what). Cheers! |
Thanks for the clarifying thoughts! I hadn't considered the Re: success. I'm not actually using this library either. I attempted a simple experiment and immediately ran into the need for |
@3noch I'd propose that one way to circumvent the necessity of It seems to me like you might be able to accomplish @mitchellwrosen regarding the |
The
base
docs forcatches
says that it resolves two issues caused by nesting exception handlers. However, this library does not providecatches
(the type would be pretty tricky). What is the recommendation when trying to handle multiple exception types in the same handler? It should be at least documented.The text was updated successfully, but these errors were encountered: