{-# LANGUAGE Trustworthy #-}
module Grisette.Lib.Control.Monad.Trans.Cont
(
mrgRunContT,
mrgEvalContT,
mrgResetT,
)
where
import Control.Monad.Cont
import Grisette.Core.Data.Class.Bool
import Grisette.Core.Data.Class.Mergeable
import Grisette.Core.Data.Class.SimpleMergeable
import Grisette.Lib.Control.Monad
mrgRunContT :: (UnionLike m, Mergeable r) => ContT r m a -> (a -> m r) -> m r
mrgRunContT :: forall (m :: * -> *) r a.
(UnionLike m, Mergeable r) =>
ContT r m a -> (a -> m r) -> m r
mrgRunContT ContT r m a
c = m r -> m r
forall (u :: * -> *) a. (UnionLike u, Mergeable a) => u a -> u a
merge (m r -> m r) -> ((a -> m r) -> m r) -> (a -> m r) -> m r
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ContT r m a -> (a -> m r) -> m r
forall {k} (r :: k) (m :: k -> *) a.
ContT r m a -> (a -> m r) -> m r
runContT ContT r m a
c
{-# INLINE mrgRunContT #-}
mrgEvalContT :: (UnionLike m, Mergeable r, Monad m) => ContT r m r -> m r
mrgEvalContT :: forall (m :: * -> *) r.
(UnionLike m, Mergeable r, Monad m) =>
ContT r m r -> m r
mrgEvalContT ContT r m r
c = ContT r m r -> (r -> m r) -> m r
forall {k} (r :: k) (m :: k -> *) a.
ContT r m a -> (a -> m r) -> m r
runContT ContT r m r
c r -> m r
forall (u :: * -> *) a. (MonadUnion u, Mergeable a) => a -> u a
mrgReturn
{-# INLINE mrgEvalContT #-}
mrgResetT :: (UnionLike m, Mergeable r, Monad m) => Monad m => ContT r m r -> ContT r' m r
mrgResetT :: forall (m :: * -> *) r r'.
(UnionLike m, Mergeable r, Monad m, Monad m) =>
ContT r m r -> ContT r' m r
mrgResetT = m r -> ContT r' m r
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m r -> ContT r' m r)
-> (ContT r m r -> m r) -> ContT r m r -> ContT r' m r
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ContT r m r -> m r
forall (m :: * -> *) r.
(UnionLike m, Mergeable r, Monad m) =>
ContT r m r -> m r
mrgEvalContT
{-# INLINE mrgResetT #-}