-
Notifications
You must be signed in to change notification settings - Fork 7
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
Export Bugsnag
prefixed type synonyms
#78
Comments
I don't necessarily disagree, but I considered it worth it to fully off-load the maintenance of all API types to the separate If you wanted to PR such a I'm interested in poking a bit at "legibility of documentation", specifically. Do you mean the As a workaround to at least recover legibility in your own code, you could always import qualified as |
I have a class class (Monad m) => MonadBugsnag m where
askBugsnagSettings :: m BugsnagSettings
localBugsnagSettings :: (BugsnagSettings -> BugsnagSettings) -> m a -> m a Even if I qualify the name to According to
I understand that this is primarily conflict with the naming philosophy of |
Thanks for that additional context, it makes sense. I forgot about
Yeah, that's the core conflict. It's either we accept it, or we retake maintenance of the entire API (either as our own types or through synonym mechanisms). Tangential, but we've done a similar thing with: class HasBugsnagSettings env where
bugsnagSettingsL :: Lens' env Bugsnag.Settings Then we can recover what you're using
This |
I generally prefer newtype ViaReader m a = ViaReader (m a)
instance (HasBugsnagSettings r, MonadReader r m) => MonadBugsnag (ViaReader m)
newtype App a = App (ReaderT Env IO a)
deriving MonadBugsnag App via ViaReader App
instance HasBugsnagSettings Env
-- allowed
newtype BugsnagChanger a = BugsnagChanger (StateT BugsnagSettings IO a)
instance MonadBugsnag BugsnagChanger where
askBugsnagSettings = get
localBugsnagSettings f action = do
prev <- get
put (f prev)
a <- action
put prev
pure a
instance MonadBugsnag IO where
-- get stuff from environment variables i guess? idk If you rely on (this is actually a big design wart in |
I'm working on upgrading our application to the new
bugsnag
frombugsnag-haskell
. I'm finding that the removal of theBugsnag
prefix from the types is a significant downgrade in the legibility of documentation and "one look comprehension". I'm working around this by defining a local module that definestype BugsnagSettings = Bugsnag.Settings
, but this is reliant on GHC not 'seeing through' the type alias in error messages and Haddocks.It would be nice to have these built in to
Data.Bugsnag
.A
Data.Bugsnag.Compat
compatibility module with pattern synonyms would also be nice for making the migration easier, but I recognize that as a lot more work.The text was updated successfully, but these errors were encountered: