tracing icon indicating copy to clipboard operation
tracing copied to clipboard

Export TraceT data constructor

Open JakubBarta opened this issue 4 years ago • 3 comments

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 avatar Jul 27 '21 12:07 JakubBarta

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

JakubBarta avatar Aug 13 '21 12:08 JakubBarta

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?

mtth avatar Aug 14 '21 14:08 mtth

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)

JakubBarta avatar Aug 16 '21 09:08 JakubBarta