datadog icon indicating copy to clipboard operation
datadog copied to clipboard

Looking for feedback: Move from monad-control & lifted-base to unliftio.

Open iand675 opened this issue 7 years ago • 6 comments

I'm considering switching over from uses of monad-control to unliftio. A few of the reasons:

  • New yesod versions don't provide instances for MonadBaseControl in Handlers.
  • There are noted issues with bracketing in the context of MonadBaseControl (see https://www.fpcomplete.com/blog/2017/06/tale-of-two-brackets). In the case of datadog's usage, bracketing is one of the main reasons that we use it, so I'd like to restrict usage to a safer subset of monad transformers.

Any feedback is welcome, but thinking about doing a major release with #18 and #21 soon, so it'd be a good time to make the transition.

iand675 avatar Jun 20 '18 23:06 iand675

@dfithian would be particularly interested to hear from you on this if you've got any opinions on it. I expect people using withDogStatsD itself in one of the 'dangerous' transformers are few and far between.

iand675 avatar Jun 20 '18 23:06 iand675

Out of the country right now but will look next week

On Wed, Jun 20, 2018, 19:46 Ian Duncan [email protected] wrote:

@dfithian https://github.com/dfithian would be particularly interested to hear from you on this if you've got any opinions on it. I expect people using withDogStatsD itself in one of the 'dangerous' transformers are few and far between.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/iand675/datadog/issues/22#issuecomment-398931807, or mute the thread https://github.com/notifications/unsubscribe-auth/AIBQ6IZt37-nkQK5xFWV2gJX7yd3wGjaks5t-t68gaJpZM4UwnXx .

dfithian avatar Jun 22 '18 14:06 dfithian

This is the first time I've heard of unliftio. It looks like the advantage is that you can provide an implementation for running a monad transformer stack without pinning the makeup of the monad stack itself. Is that right? In addition, another advantage would be that one could nest ResourceT blocks? Certainly the latter is a beneficial result; many a time have I been bit by accidentally embedding multiple runResourceT calls.

dfithian avatar Jul 02 '18 14:07 dfithian

I would say that given the ResourceT problem presents as a runtime error I'd be very careful about this change and make sure that it's not only called out in the README. Also potentially not completely rewriting the API but deprecating the old API and providing a new implementation.

dfithian avatar Jul 02 '18 14:07 dfithian

Okay I'm totally on the MonadUnliftIO bandwagon now. Having used it this week I'm heavily in favor of banishing ExceptT to purgatory.

dfithian avatar Jul 06 '18 16:07 dfithian

👍 glad to hear it. I think given that Yesod has dropped MonadBaseControl, it leaves us in a less-than-desirable position for popular usage.

iand675 avatar Jul 07 '18 02:07 iand675