.. title:: Option lisa.monad.Option ================= .. autoclass:: lisa.monad::Option :no-members: :no-inherited-members: :no-undoc-members: :no-private-members: :no-special-members: .. rubric:: Attributes .. list-table:: :align: left * - :attr:`~lisa.monad.Option.__slots__` - .. withrefctx:: :module: lisa.monad :class: lisa.monad.Option .. rubric:: Properties .. list-table:: :align: left * - :attr:`~lisa.monad.Option.x` - .. withrefctx:: :module: lisa.monad :class: lisa.monad.Option Wrapped value, of type ``Base[_Optional[A]]`` with ``Base`` the base monad of the transformer. .. rubric:: Methods .. list-table:: :align: left * - :meth:`~lisa.monad.Option.bind` - .. withrefctx:: :module: lisa.monad :class: lisa.monad.Option Takes a monadic value Monad[A], a function that takes an A and returns Monad[B], and returns a Monad[B]. * - :meth:`~lisa.monad.Option.hoist` - .. withrefctx:: :module: lisa.monad :class: lisa.monad.Option Lift a monadic value ``m`` by one level in the stack, i.e.: Given a stack for 3 transformers ``T1(T2(T3(Identity)))``, a value ``m = T2(Identity).pure(42)``. we have ``T2.hoist(m, T3.pure) == T2(T3(Identity)).pure(42)``. * - :meth:`~lisa.monad.Option.lift` - .. withrefctx:: :module: lisa.monad :class: lisa.monad.Option Lift a monadic value ``m`` by one level in the stack, i.e.: Given a stack for 3 transformers ``T1(T2(T3(Identity)))``, a value ``m = T3(Identity).pure(42)``. we have ``T2.lift(m) == T2(T3(Identity)).pure(42)``. * - :meth:`~lisa.monad.Monad.__await__` :sup:`inherited` - .. withrefctx:: :module: lisa.monad :class: lisa.monad._MonadBase * - :meth:`~lisa.monad.MonadTrans.do` :sup:`inherited` - .. withrefctx:: :module: lisa.monad :class: lisa.monad.MonadTrans Decorate a coroutine function so that ``awaits`` gains the powers of the monad. * - :meth:`~lisa.monad.Monad.join` :sup:`inherited` - .. withrefctx:: :module: lisa.monad :class: lisa.monad.Monad Takes a monadic value Monad[Monad[A]], and returns a Monad[A]. * - :meth:`~lisa.monad.Monad.map` :sup:`inherited` - .. withrefctx:: :module: lisa.monad :class: lisa.monad.Monad Takes a monadic value Monad[A], a function that takes an A and returns B, and returns a Monad[B]. * - :meth:`~lisa.monad.MonadTrans.pure` :sup:`inherited` - .. withrefctx:: :module: lisa.monad :class: lisa.monad.MonadTrans Turn a regular value of type ``A`` into a monadic value of type ``Monad[A]``. Attributes ---------- .. autoattribute:: lisa.monad::Option.__slots__ Properties ---------- .. autoproperty:: lisa.monad::Option.x Methods ------- .. automethod:: lisa.monad::Option.bind .. automethod:: lisa.monad::Option.hoist .. automethod:: lisa.monad::Option.lift .. automethod:: lisa.monad::Option.__await__ .. automethod:: lisa.monad::Option.do .. automethod:: lisa.monad::Option.join .. automethod:: lisa.monad::Option.map .. automethod:: lisa.monad::Option.pure