lisa.monad.AsyncIO#
- class lisa.monad.AsyncIO(coro)[source]#
Bases:
Async
Specialization of
lisa.monad.Async
toasyncio
event loop.Attributes
__slots__
inheritedProperties
coro
inheritedCoroutine 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.
x
inheritedRun 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
awaits
gains the powers of the monad.hoist()
inheritedLift a monadic value
m
by 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
m
by 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
A
into a monadic value of typeMonad[A]
.
Attributes#
- AsyncIO.__slots__ = ('_coro',)#
Properties#
- property AsyncIO.coro#
Inherited property, see
lisa.monad.Async.coro
Coroutine 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.x
Run 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
_TailCall
instance.
- 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
awaits
gains the powers of the monad.
- classmethod AsyncIO.hoist(self, nat)#
Inherited method, see
lisa.monad.Async.hoist()
Lift a monadic value
m
by 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
m
by 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
A
into a monadic value of typeMonad[A]
.