parsonsmatt / annotated-exception

Machinery for throwing and catching exceptions with some annotation.
BSD 3-Clause "New" or "Revised" License
32 stars 3 forks source link

More specific module names for varying exception flavors #11

Open parsonsmatt opened 2 years ago

parsonsmatt commented 2 years ago

The design of this module for import/export is unfortunate. We define a term new, which is clearly meant to be imported qualified, but then we also have functions catch throw etc that are meant to be imported unqualified and act as drop-in replacements for other exception modules.

Worse, we have Control.Exception.Annotated which wraps Control.Exception.Safe, but then we have Control.Exception.Annotated.UnliftIO which wraps UnliftIO.Exception. If we're going to have module name suffixes that indicate the exception behavior you're getting, then we should follow that convention more carefully.

Probably we should do something like:

module Data.AnnotatedException where ...

    data AnnotatedException e

    makeAnnotatedHandlers :: Handler a -> [Handler a]    

module Control.Exception.Annotated where 

    import Control.Exception

module Control.Exception.Annotated.Safe where

    import Control.Exception.Safe

module Control.Exception.Annotated.UnliftIO where

    import UnliftIO.Exception