Is MonadBase IO better than MonadIO?
To me, MonadBase IO doesn't seem to add anything that MonadIO doesn't already do. However, the use of MonadBase IO means that my library now incurs a dependency on transformers-base, and potential my downstream users too. I may have misunderstood something, but if possible I think
onExit :: (region ~ RegionT s parent, MonadIO parent) => Finalizer -> region (FinalizerHandle region)
is preferable. If that doesn't work due to the type signature, then I'd just go with
onExit :: MonadIO parent => Finalizer -> RegionT s parent (FinalizerHandle (RegionT s parent))
(as it was before).
Hi Ollie, I used MonadBase in regions because I used it in monad-control. I used MonadBase in monad-control because I wanted to generalize MonadBaseControl so that users can use it with the ST or STM base monads.
I don't think many (any) users are actually doing that though so it might not be that useful. However, switching monad-control to MonadIO at this point will break lots of code.
Although it might be possible to specialize regions to MonadIO. The specialization doesn't matter there because regions operates with an IO base monad anyway.
Although it might be possible to specialize
regionstoMonadIO. The specialization doesn't matter there becauseregionsoperates with anIObase monad anyway.
Right, that was my main thought - we already have a well established class in a more prominant package that expresses exactly what you want. This change would only need to be done in regions, which (I assume) has a lot less users.
Yes I think this makes sense. I don't have much time to work on this I'm afraid.
Care to give it a shot?
Bas van Dijk [email protected] writes:
Yes I think this makes sense. I don't have much time to work on this I'm afraid.
Care to give it a shot?
Will do!
Did anything end up happening about this?
I've fixed this in the RegionIOControl branch.