-
Notifications
You must be signed in to change notification settings - Fork 8
Design of bugsnag-2.0 #93
Description
Looking over our open issues, and other discussions with @parsonsmatt has me considering a[nother] rewrite of this library.
There was a big shift in the deprecation of bugsnag-haskell in favor of the current bugsnag library solely due to wanting to re-use bugsnag-hs for the API types, rather than maintaining our own. This forced a number of other changes that, in isolation, aren't the best. After letting the dust settle and finding some upstream issues opened there going unanswered, I think it's appropriate to revisit that choice -- there's no value in offloading onto an upstream if they're not themselves actively maintained.
So, I think we should take back over and author our own Data.Bugsnag.* and release that as a new major version. I'd like to use this Issue to describe the choices I'd plan to make and get feedback before proceeding.
What I'm thinking:
-
Data.Bugsnag.{Type}, each exposing aBugsnag{Type}record, withbugsnag{Type}{Field}fields and{type}_{field}lensesThis convention follows Amazonka, and seems generally reasonable. The lenses will be useful in authoring
BeforeNotifyfunctions. This will close ExportBugsnagprefixed type synonyms #78 and Lens-based interfaces #65. -
Data.Bugsnag.Exceptionwill includebugsnagExceptionOriginalException, which will beSomeExceptionThis will close
BeforeNotifyAPI is less powerful than before #80. This is an open design point. I'm proposing we put it onExceptionand notEventsince the Bugsnag API itself models 1-event-to-N-exceptions, but a single exception per event is actually way more ergonomic, so I'm very open to being convinced otherwise (and may in fact change my mind myself). -
Due to the above,
BeforeNotifycan just become anewtypeoverEndo BugsnagEvent, with a derived<>This, combined with some
HasBugsnagSettingsreader results in cool stuff like:local (bugsnagSettingsL . settings_beforeNotify <>~ setSeverityWarning) $ do -- ... setSeverityWarning :: BeforeNotify setSeverityWarning = beforeNotify $ event_severity .~ WarningSeverity
-
I will add
Control.Monad.Bugsnagwith (something like)MonadBugsnag(notify)with variousDerivingVianewtypes.I know there are a few concrete suggestions for what this should look like, and it may be worth getting into. Perhaps this should be a new
bugsnag-mtlpackage? ADerivignVianewtype for testing would solve Integration testing #47.
The addition of lenses and MonadBugsnag could (should?) actually come later anyway, since that won't incur a major version bump.