Skip to content

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

@torgeirsh

Description

@torgeirsh

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions