
2 Feb
2019
2 Feb
'19
6:28 a.m.
Hi, I'm getting stuck on implementing `MonadBaseControl IO` for my application context type. What I have so far (in a minimized example) is ``` data Env = Env {envBalance :: !(TVar Int)} newtype AppM a = AppM { unAppM :: ReaderT Env IO a } deriving (Functor, Applicative, Monad, MonadIO, MonadReader Env) instance MonadBase IO AppM where liftBase = liftIO instance MonadBaseControl IO AppM where type StM AppM a = a liftBaseWith f = undefined restoreM = return ``` I'm so utterly stuck on the definition of `liftBaseWith`... but I'm not 100% sure on the other bits either, though it "feels right". Any tips on how I should go about it? /M