eventuo11y 0.3.1.0 → 0.3.2.0
raw patch · 4 files changed
+30/−13 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Observe.Event: hoistEvent :: (Functor m, Functor n) => (forall x. m x -> n x) -> Event m r s f -> Event n r s f
+ Observe.Event.Backend: hoistEventImpl :: (forall x. m x -> n x) -> EventImpl m r f -> EventImpl n r f
Files
- CHANGELOG.md +4/−0
- eventuo11y.cabal +2/−2
- src/Observe/Event.hs +10/−0
- src/Observe/Event/Backend.hs +14/−11
CHANGELOG.md view
@@ -1,5 +1,9 @@ # Revision history for eventuo11y +## 0.3.2.0 -- 2022-10-04++Add hoistEvent+ ## 0.3.1.0 -- 2022-10-04 Add causedEventBackend
eventuo11y.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: eventuo11y-version: 0.3.1.0+version: 0.3.2.0 synopsis: An event-oriented observability library description: Instrument your Haskell codebase with wide, semantically meaningful events.@@ -26,7 +26,7 @@ See "Observe.Event.Backend" for documentation on writing an @EventBackend@. - See [Example.hs](https://github.com/shlevy/eventuo11y/tree/v0.3.1.0/Example.hs) for an example.+ See [Example.hs](https://github.com/shlevy/eventuo11y/tree/v0.3.2.0/Example.hs) for an example. See [eventuo11y-batteries](https://hackage.haskell.org/package/eventuo11y-batteries) for miscellaneous framework-specific helpers.
src/Observe/Event.hs view
@@ -40,6 +40,7 @@ -- t'Observe.Event.Render.JSON.RenderFieldJSON' to use JSON rendering 'EventBackend's. module Observe.Event ( Event,+ hoistEvent, -- * Event manipulation #eventmanip# reference,@@ -104,6 +105,15 @@ -- | A 'OnceFlag' to ensure we only finish ('finalize' or 'failEvent') once. finishFlag :: !(OnceFlag m) }++-- | Hoist an 'Event' along a given natural transformation into a new monad.+hoistEvent :: (Functor m, Functor n) => (forall x. m x -> n x) -> Event m r s f -> Event n r s f+hoistEvent nt Event {..} =+ Event+ { backend = hoistEventBackend nt backend,+ impl = hoistEventImpl nt impl,+ finishFlag = hoistOnceFlag nt finishFlag+ } -- | Obtain a reference to an 'Event'. --
src/Observe/Event/Backend.hs view
@@ -18,6 +18,7 @@ unitEventBackend, pairEventBackend, hoistEventBackend,+ hoistEventImpl, narrowEventBackend, narrowEventBackend', @@ -154,19 +155,21 @@ EventBackend n r s hoistEventBackend nt backend = EventBackend- { newEventImpl = nt . fmap hoistEventImpl . newEventImpl backend,+ { newEventImpl = nt . fmap (hoistEventImpl nt) . newEventImpl backend, newOnceFlag = hoistOnceFlag nt <$> (nt $ newOnceFlag backend) }- where- hoistEventImpl (EventImpl {..}) =- EventImpl- { referenceImpl,- addFieldImpl = nt . addFieldImpl,- addParentImpl = nt . addParentImpl,- addProximateImpl = nt . addProximateImpl,- finalizeImpl = nt $ finalizeImpl,- failImpl = nt . failImpl- }++-- | Hoist an 'EventImpl' along a given natural transformation into a new monad.+hoistEventImpl :: (forall x. m x -> n x) -> EventImpl m r f -> EventImpl n r f+hoistEventImpl nt (EventImpl {..}) =+ EventImpl+ { referenceImpl,+ addFieldImpl = nt . addFieldImpl,+ addParentImpl = nt . addParentImpl,+ addProximateImpl = nt . addProximateImpl,+ finalizeImpl = nt finalizeImpl,+ failImpl = nt . failImpl+ } -- | Narrow an 'EventBackend' to a new selector type via a given injection function. --