lisa.monad.AsyncIO#

class lisa.monad.AsyncIO(coro)[source]#

Bases: Async

Specialization of lisa.monad.Async to asyncio event loop.

Attributes

__slots__ inherited

Properties

coro inherited

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.

x inherited

Run the coroutine to completion in its event loop.

Methods

bind()

Takes a monadic value Monad[A], a function that takes an A and returns Monad[B], and returns a Monad[B].

__await__() inherited

do() inherited

Decorate a coroutine function so that awaits gains the powers of the monad.

hoist() inherited

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).

join() inherited

Takes a monadic value Monad[Monad[A]], and returns a Monad[A].

lift() inherited

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).

map() inherited

Takes a monadic value Monad[A], a function that takes an A and returns B, and returns a Monad[B].

pure() inherited

Turn a regular value of type A into a monadic value of type Monad[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 transformers T1(T2(T3(Identity))), a value m = T2(Identity).pure(42). we have T2.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 transformers T1(T2(T3(Identity))), a value m = T3(Identity).pure(42). we have T2.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 type Monad[A].