Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add something like Control.Exception.Safe.withException to Effectful.Exception. #304

Open
torgeirsh opened this issue Feb 28, 2025 · 0 comments

Comments

@torgeirsh
Copy link

The documentation says:

If you want to catch all exceptions, run a cleanup action and rethrow, use one of the functions from the cleanup section.

While several of those functions let you specify a an action to be performed when an exception is thrown, they don't give you access to the actual exception. This problem is shared with the Control.Exception module in the base package, but the safe-exceptions package contains this useful function that otherwise behaves like onException:

withException :: Exception e => IO a -> (e -> IO b) -> IO a

It would be great if effectful could provide a similar function, since it's easy to get the edge cases wrong when dealing with asynchronous exceptions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant