valpackett / magicbane

A web framework that integrates Servant, EKG, fast-logger, wai-cli… | now on https://codeberg.org/valpackett/magicbane

Home Page:https://codeberg.org/valpackett/magicbane

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Consider replacing ClassyPrelude with RIO (revisited)

akhra opened this issue · comments

In the wake of #10, we now have:

Okay, what's MagicbaneApp?

newtype MagicbaneApp β α = MagicbaneApp {
 unMagicbaneApp ∷ ReaderT β IO α }

It's just a ReaderT over IO!

This is exactly the RIO monad:

newtype RIO env a = RIO { unRIO :: ReaderT env IO a }

It would be nice to unify these!

Yeah, I thought about this, but the dependency…

(And it's not exactly the RIO monad ­— MagicbaneApp derives many many more typeclasses! Including MonadMask which is necessary for monad-metrics.)

Does the rio library even define anything on RIO specifically? As far as I can tell, it mostly reexports functions that are defined on various typeclasses.

Hm, good point. This might be something worth discussing directly with @snoyberg. There's a relevant open issue: commercialhaskell/rio#38

hah, I saw this issue (but didn't realize you posted in it)

I also derive MonadBase IO, MonadBaseControl IO for various things. In general, it seems that RIO is aimed at minimal modern clean applications. What I'm going for here is maximum compatibility with whatever crap you can plug into a monad :D

It may be reasonable to define a rio-orphans companion package that has all of those missing instances.

^ This got done. RIO now has all the instances Magicbane does, plus bonus MonadResource and PrimMonad.

Now using RIO, @tejon please test :)

Smooth transition, everything looks great!