mtth / tracing

Distributed tracing
https://hackage.haskell.org/package/tracing
BSD 3-Clause "New" or "Revised" License
24 stars 11 forks source link

Export TraceT data constructor #19

Open JakubBarta opened 3 years ago

JakubBarta commented 3 years ago

First of all, I'd like to thank you for your great work on this library!

This PR exports the TraceT data constructor, thus allowing for more instances for TraceT to be defined.

The project I'm working on unfortunately doesn't work well with UnliftIO, so I have to define instances for MonadBaseControl IO.

JakubBarta commented 3 years ago

Hi @mtth Did you have an opportunity to have a look at this PR? :)

mtth commented 3 years ago

Hi @JakubBarta, apologies for the delay. I'm concerned that this change will restrict our ability to evolve the library. For example https://github.com/mtth/tracing/pull/13 might have broken clients if they relied on the type's representation. I understand the usefulness of being able to define new instances but I'm not sure what a good solution to allow it is yet.

Could you share the instance MonadBaseControl instance implementation you'd use?

JakubBarta commented 3 years ago

Hi @mtth, thanks for the quick reply! I actually had to define instances for multiple typeclasses. Most of them are derived:

deriving newtype instance MonadBaseControl IO m => MonadBaseControl IO (TraceT m)
deriving newtype instance MonadBase IO m => MonadBase IO (TraceT m)
deriving newtype instance MonadMask m => MonadMask (TraceT m)
deriving newtype instance MonadThrow m => MonadThrow (TraceT m)
deriving newtype instance MonadFail m => MonadFail (TraceT m)
deriving newtype instance (MonadCatch m, MonadThrow m) => MonadCatch (TraceT m)