lisa.monad.AsyncIO#
- class lisa.monad.AsyncIO(coro)[source]#
Bases:
AsyncSpecialization of
lisa.monad.Asynctoasyncioevent loop.Attributes
__slots__inheritedProperties
coroinheritedCoroutine that will only yield non-monadic values. All the monadic values will be processed by the monad transformer stack as expected and will stay hidden.
xinheritedRun the coroutine to completion in its event loop.
Methods
Takes a monadic value Monad[A], a function that takes an A and returns Monad[B], and returns a Monad[B].
__await__()inheriteddo()inheritedDecorate a coroutine function so that
awaitsgains the powers of the monad.hoist()inheritedLift a monadic value
mby one level in the stack, i.e.: Given a stack for 3 transformersT1(T2(T3(Identity))), a valuem = T2(Identity).pure(42). we haveT2.hoist(m, T3.pure) == T2(T3(Identity)).pure(42).join()inheritedTakes a monadic value Monad[Monad[A]], and returns a Monad[A].
lift()inheritedLift a monadic value
mby one level in the stack, i.e.: Given a stack for 3 transformersT1(T2(T3(Identity))), a valuem = T3(Identity).pure(42). we haveT2.lift(m) == T2(T3(Identity)).pure(42).map()inheritedTakes a monadic value Monad[A], a function that takes an A and returns B, and returns a Monad[B].
pure()inheritedTurn a regular value of type
Ainto a monadic value of typeMonad[A].
Attributes#
- AsyncIO.__slots__ = ('_coro',)#
Properties#
- property AsyncIO.coro#
Inherited property, see
lisa.monad.Async.coroCoroutine that will only yield non-monadic values. All the monadic values will be processed by the monad transformer stack as expected and will stay hidden.
- property AsyncIO.x#
Inherited property, see
lisa.monad.Async.xRun the coroutine to completion in its event loop.
Methods#
- AsyncIO.bind(continuation)#
Takes a monadic value Monad[A], a function that takes an A and returns Monad[B], and returns a Monad[B].
Note
It is allowed to return a
_TailCallinstance.
- AsyncIO.__await__()#
Inherited method, see
lisa.monad.Monad.__await__()
- classmethod AsyncIO.do(f)#
Inherited method, see
lisa.monad.MonadTrans.do()Decorate a coroutine function so that
awaitsgains the powers of the monad.
- classmethod AsyncIO.hoist(self, nat)#
Inherited method, see
lisa.monad.Async.hoist()Lift a monadic value
mby one level in the stack, i.e.: Given a stack for 3 transformersT1(T2(T3(Identity))), a valuem = T2(Identity).pure(42). we haveT2.hoist(m, T3.pure) == T2(T3(Identity)).pure(42).
- classmethod AsyncIO.join(self)#
Inherited method, see
lisa.monad.Monad.join()Takes a monadic value Monad[Monad[A]], and returns a Monad[A].
- classmethod AsyncIO.lift(x)#
Inherited method, see
lisa.monad.Async.lift()Lift a monadic value
mby one level in the stack, i.e.: Given a stack for 3 transformersT1(T2(T3(Identity))), a valuem = T3(Identity).pure(42). we haveT2.lift(m) == T2(T3(Identity)).pure(42).
- classmethod AsyncIO.map(self, f)#
Inherited method, see
lisa.monad.Monad.map()Takes a monadic value Monad[A], a function that takes an A and returns B, and returns a Monad[B].
- classmethod AsyncIO.pure(x)#
Inherited method, see
lisa.monad.MonadTrans.pure()Turn a regular value of type
Ainto a monadic value of typeMonad[A].