AsyncCpsMonad
The dotty-cps-async monad instance for Async. This is the single bridge between the DCA macro and our encoding: the macro emits cps.block / cps.async nodes that drive these six methods, all of which delegate to the zero-cost inline Async surface (map / flatMap / catchAll).
It is an object (not an anonymous given) so the zio.blocks.async macro can reference it by a stable fully-qualified name when it splices the generated cps.async[Async] { ... } block. The companion given below makes the same instance available for ordinary implicit search (e.g. DCA's summon[CpsMonad[Async]]).
CpsTryMonadInstanceContext provides the Context type and the apply method for free; we only implement the five primitives DCA needs: pure, map, flatMap, error, and flatMapTry.
Attributes
- Source
- AsyncCpsMonad.scala
- Graph
-
- Supertypes
- Self type
-
AsyncCpsMonad.type
Members list
Type members
Inherited types
Attributes
- Inherited from:
- CpsTryMonadInstanceContext
- Source
- CpsMonadContext.scala
Inherited and Abstract types
Attributes
- Inherited from:
- CpsMonad
- Source
- CpsMonad.scala
Value members
Concrete methods
run op in the context environment.
run op in the context environment.
Attributes
- Definition Classes
-
CpsTryMonadInstanceContext -> CpsMonad
- Source
- AsyncCpsMonad.scala
represent error e in monadic context.
bind combinator, which compose f over fa
Run f against the Try-shaped outcome of fa. A ready value or a Failure is dispatched directly (no Pollable allocation); a suspended input is reified to Async[Try[A]] via map/catchAll and then handed to f. Exceptions thrown by f itself are captured as Async.fail so the DCA try/catch rewrite observes them as monadic failures.
Run f against the Try-shaped outcome of fa. A ready value or a Failure is dispatched directly (no Pollable allocation); a suspended input is reified to Async[Try[A]] via map/catchAll and then handed to f. Exceptions thrown by f itself are captured as Async.fail so the DCA try/catch rewrite observes them as monadic failures.
Attributes
- Source
- AsyncCpsMonad.scala
map a function f over fa
Pure - wrap value t inside monad.
Pure - wrap value t inside monad.
Note, that pure use eager evaluation, which is different from Haskell.
Attributes
- Source
- AsyncCpsMonad.scala
ensure that action will run before getting value from fa
ensure that action will run before getting value from fa
Attributes
- Definition Classes
-
CpsTryMonad
- Source
- AsyncCpsMonad.scala
return result of fa after completition of action.
return result of fa after completition of action.
Attributes
- Definition Classes
-
CpsTryMonad
- Source
- AsyncCpsMonad.scala
Inherited methods
Wrap and flatten of monadic expression..
Attributes
- Inherited from:
- CpsMonad
- Source
- CpsMonad.scala
transform r into pure value or error.
map over result of checked evaluation of A
map over result of checked evaluation of A
Attributes
- Inherited from:
- CpsTryMonad
- Source
- CpsMonad.scala
synonym for flatMapTry needed for processing awaits inside mapTry.
synonym for flatMapTry needed for processing awaits inside mapTry.
Attributes
- Inherited from:
- CpsTryMonad
- Source
- CpsMonad.scala
restore fa, ie if fa sucessful - return fa, otherwise apply fx to received error.
restore fa, ie if fa sucessful - return fa, otherwise apply fx to received error.
Attributes
- Inherited from:
- CpsTryMonad
- Source
- CpsMonad.scala
Stack-safe monadic recursion.
Stack-safe monadic recursion.
Iterates f until it returns Right(b).
Left(a1)means continue with new statea1Right(b)means done with resultb
The default implementation uses flatMap recursively, which is stack-safe for monads with internal trampolining (TailRec, IO, Future, etc.) but NOT for identity-like monads. Override for those cases.
Attributes
- Inherited from:
- CpsMonad
- Source
- CpsMonad.scala
try to evaluate async operation and wrap successful or failed result into F.
try to evaluate async operation and wrap successful or failed result into F.
Attributes
- Inherited from:
- CpsTryMonad
- Source
- CpsMonad.scala
try to evaluate synchonious operation and wrap successful or failed result into F.
try to evaluate synchonious operation and wrap successful or failed result into F.
Attributes
- Inherited from:
- CpsTryMonad
- Source
- CpsMonad.scala
async shift of tryPure.
async shift of withAction.
async shift of withAction.
This method is substituted instead withAction, when we use await inside withAction argument.
Attributes
- Inherited from:
- CpsTryMonad
- Source
- CpsMonad.scala
Attributes
- Inherited from:
- CpsTrySupport
- Source
- CpsMonad.scala
Attributes
- Inherited from:
- CpsTrySupport
- Source
- CpsMonad.scala
Create monadic expression according to the default operation of choosen monad types. (i.e. delaying for effect monads, starting for eager monand, pure by default)
Create monadic expression according to the default operation of choosen monad types. (i.e. delaying for effect monads, starting for eager monand, pure by default)
Attributes
- Inherited from:
- CpsMonad
- Source
- CpsMonad.scala