#if MIN_VERSION_monad_control(1,0,0)
#endif
module Control.Distributed.Process.MonadBaseControl
(
) where
import Control.Distributed.Process.Internal.Types
( Process(..)
, LocalProcess
)
import Control.Monad.Base (MonadBase(..))
import Control.Monad.Trans.Control (MonadBaseControl(..))
import Control.Monad.Trans.Reader (ReaderT)
deriving instance MonadBase IO Process
#if MIN_VERSION_monad_control(1,0,0)
instance MonadBaseControl IO Process where
type StM Process a = StM (ReaderT LocalProcess IO) a
liftBaseWith f = Process $ liftBaseWith $ \ rib -> f (rib . unProcess)
restoreM = Process . restoreM
#else
instance MonadBaseControl IO Process where
newtype StM Process a = StProcess {_unSTProcess :: StM (ReaderT LocalProcess IO) a}
restoreM (StProcess m) = Process $ restoreM m
liftBaseWith f = Process $ liftBaseWith $ \ rib -> f (fmap StProcess . rib . unProcess)
#endif