module Control.Monad.Schedule.Yield where
import qualified Control.Concurrent as Concurrent
import Control.Monad.IO.Class
import Data.Functor.Identity (Identity (runIdentity))
import Control.Monad.Schedule.Class
import Control.Monad.Schedule.Trans
type YieldT = ScheduleT ()
type Yield = YieldT Identity
yield :: Monad m => YieldT m ()
yield :: forall (m :: * -> *). Monad m => YieldT m ()
yield = forall (m :: * -> *) diff. Monad m => diff -> ScheduleT diff m ()
wait ()
runYieldT :: Monad m => YieldT m a -> m a
runYieldT :: forall (m :: * -> *) a. Monad m => YieldT m a -> m a
runYieldT = forall (m :: * -> *) diff a.
Monad m =>
(diff -> m ()) -> ScheduleT diff m a -> m a
runScheduleT forall a b. (a -> b) -> a -> b
$ forall a b. a -> b -> a
const forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a. Monad m => a -> m a
return ()
runYield :: Yield a -> a
runYield :: forall a. Yield a -> a
runYield = forall a. Identity a -> a
runIdentity forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) a. Monad m => YieldT m a -> m a
runYieldT
runYieldIO
:: MonadIO m
=> YieldT m a -> m a
runYieldIO :: forall (m :: * -> *) a. MonadIO m => YieldT m a -> m a
runYieldIO = forall (m :: * -> *) diff a.
Monad m =>
(diff -> m ()) -> ScheduleT diff m a -> m a
runScheduleT forall a b. (a -> b) -> a -> b
$ forall a b. a -> b -> a
const forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO IO ()
Concurrent.yield