Maintainer | Ertugrul Soeylemez <es@ertes.de> |
---|---|

Safe Haskell | None |

- class (Plus f, Monad m, Monoid e) => MonadContinue e f m | m -> e, m -> f where
- addCont_ :: MonadContinue e f m => f (m ()) -> m ()
- continue :: MonadContinue e f m => Either e a -> f (Either e a) -> m a
- continue_ :: MonadContinue e f m => f () -> m ()
- suspend :: MonadContinue e f m => e -> m a
- suspendWith :: MonadContinue e f m => f (m a) -> m a

# Suspension

class (Plus f, Monad m, Monoid e) => MonadContinue e f m | m -> e, m -> f whereSource

Type class for monads that support suspension and continuation spots.

:: Either e a | What to return now (left suspends). |

-> f (m a) | What to run and return when reentering. |

-> m a |

Add the given set of continuations and possibly suspend.

MonadContinue e f m => MonadContinue e f (MaybeT m) | |

MonadContinue e f m => MonadContinue e f (IdentityT m) | |

(MonadContinue e f m, Monoid l) => MonadContinue e f (WriterT l m) | |

(MonadContinue e f m, Monoid l) => MonadContinue e f (WriterT l m) | |

MonadContinue e f m => MonadContinue e f (StateT s m) | Time travel warning: Captures the current state, not the state at
reentry. Use |

MonadContinue e f m => MonadContinue e f (StateT s m) | Time travel warning: Captures the current state, not the state at
reentry. Use |

MonadContinue e f m => MonadContinue e f (ReaderT r m) | |

(Monad m, Monoid e, Plus f) => MonadContinue e f (ContinueT e f m) |

# Basic utilities

addCont_ :: MonadContinue e f m => f (m ()) -> m ()Source

Add the given set of continuations without suspending.

:: MonadContinue e f m | |

=> Either e a | What to return now (left suspends). |

-> f (Either e a) | What to return when reentering (left suspends). |

-> m a |

Allow to continue here with the given value.

suspend :: MonadContinue e f m => e -> m aSource

Suspend with the given value. Does not register any continuation
spots. Note that `suspend mempty`

is equivalent to `empty`

.

suspendWith :: MonadContinue e f m => f (m a) -> m aSource

Suspend with `mempty`

and register the given continuations. Note
that `suspendWith zero`

is equivalent to `empty`

.