How to create a monad which allows IO but is NOT a MonadIO?

Viewed 220

I'm trying to create a monad where only specific IO functions are allowed. This means that this hypothetical monad cannot be a MonadIO and cannot allow liftIO to be called.

Here's what I have till now, but I'm stuck with the Monad instance for AppM:

data AppM a = AppM {unwrapAppM :: ReaderT Env (LoggingT IO) a}

instance Functor AppM where
  fmap fn appm = AppM $ fmap fn (unwrapAppM appm)


instance Applicative AppM where
  pure a = AppM $ pure a
1 Answers
Related