monadology-0.4: The best ideas in monad-related classes and types.
Safe HaskellNone
LanguageGHC2021

Control.Monad.Ology.General.Coroutine

Synopsis

Documentation

class Monad m => MonadCoroutine (m :: Type -> Type) where Source #

Monads in which one can do coroutines.

Methods

coroutineSuspend :: ((p -> m q) -> m r) -> CoroutineT p q m r Source #

Instances

Instances details
MonadCoroutine IO Source #

Uses threads.

Instance details

Defined in Control.Monad.Ology.General.Coroutine

Methods

coroutineSuspend :: ((p -> IO q) -> IO r) -> CoroutineT p q IO r Source #

(MonadTransTunnel t, MonadCoroutine m) => MonadCoroutine (t m) Source # 
Instance details

Defined in Control.Monad.Ology.General.Coroutine

Methods

coroutineSuspend :: ((p -> t m q) -> t m r) -> CoroutineT p q (t m) r Source #

type With (m :: k -> Type) t = forall (r :: k). (t -> m r) -> m r Source #

A type synoynm for a common pattern for closing opened resources, e.g. withFile, withBinaryFile, etc.

unpickWith :: MonadCoroutine m => With m a -> m (a, m ()) Source #

pickWith :: Monad m => m (a, m ()) -> With m a Source #