.. title:: monad lisa.monad ========== .. toctree:: :hidden: Nothing Async AsyncIO Monad MonadTrans Option Some State StateDiscard TransformerStack AlreadyCalledError .. module:: lisa.monad .. withrefctx:: :module: lisa.monad .. automodule:: lisa.monad :no-index: :no-members: :no-inherited-members: :no-undoc-members: :no-private-members: :no-special-members: .. rubric:: Globals .. list-table:: :align: left * - :data:`~lisa.monad.Nothing` - .. withrefctx:: :module: lisa.monad Similar to :class:`Some` but indicating the absence of value. .. rubric:: Classes .. list-table:: :align: left * - :class:`~lisa.monad.Async` - .. withrefctx:: :module: lisa.monad :class: lisa.monad.Async Monad transformer allowing the decorated coroutine function to await on non-monadic values. This is useful to mix any monad transformer defined in this module with other async APIs, such as :mod:`asyncio`. * - :class:`~lisa.monad.AsyncIO` - .. withrefctx:: :module: lisa.monad :class: lisa.monad.AsyncIO Specialization of :class:`lisa.monad.Async` to :mod:`asyncio` event loop. * - :class:`~lisa.monad.Monad` - .. withrefctx:: :module: lisa.monad :class: lisa.monad.Monad Abstract Base Class parametrized by a type T, like a container of some sort. * - :class:`~lisa.monad.MonadTrans` - .. withrefctx:: :module: lisa.monad :class: lisa.monad.MonadTrans Base class for monad transformers. * - :class:`~lisa.monad.Option` - .. withrefctx:: :module: lisa.monad :class: lisa.monad.Option Monad transformer that manipulates :class:`Some` and :attr:`Nothing`. * - :class:`~lisa.monad.Some` - .. withrefctx:: :module: lisa.monad :class: lisa.monad.Some Wraps an arbitrary value to indicate its presence. * - :class:`~lisa.monad.State` - .. withrefctx:: :module: lisa.monad :class: lisa.monad.State Monad transformer analogous to Haskell's ``StateT`` transformer. * - :class:`~lisa.monad.StateDiscard` - .. withrefctx:: :module: lisa.monad :class: lisa.monad.StateDiscard Same as :class:`State` except that calling monadic values will return the computed value instead of a tuple ``(value, state)``. .. rubric:: Functions .. list-table:: :align: left * - :func:`~lisa.monad.TransformerStack` - .. withrefctx:: :module: lisa.monad Allows stacking together multiple :class:`MonadTrans`, e.g.::. .. rubric:: Exceptions .. list-table:: :align: left * - :class:`~lisa.monad.AlreadyCalledError` - .. withrefctx:: :module: lisa.monad :class: lisa.monad.AlreadyCalledError Exception raised by :class:`_CallOnce` when the wrapped function has already been called once.