zio.blocks.async.internal
Members list
Type members
Classlikes
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).
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
- Supertypes
- Self type
-
AsyncCpsMonad.type
JVM-only runtime-await fallback for DCA.
JVM-only runtime-await fallback for DCA.
The DCA macro rewrites .block into flatMap/map chains for all positions it understands (sequential, if, while, try/catch, match, and higher-order calls that have an AsyncShift). For the residual cases it cannot rewrite — e.g. an .block inside a plain user lambda with no shift — it falls back to this instance, which drives the Async to its value by blocking the calling thread (Loom-friendly, via the same parker as Async.block).
There is deliberately no equivalent on JS: a non-rewritable .block there is a compile error, since JavaScript cannot block.
This is not a cps.CpsRuntimeAsyncAwait — providing only the plain CpsRuntimeAwait keeps the macro rewrite as the primary path and uses blocking strictly as a last resort.
Attributes
- Source
- AsyncRuntimeAwait.scala
- Supertypes
- Self type
-
asyncRuntimeAwait.type
Givens
Givens
Implicit handle to the singleton AsyncCpsMonad for DCA's implicit search.
Implicit handle to the singleton AsyncCpsMonad for DCA's implicit search.
Attributes
- Source
- AsyncCpsMonad.scala
JVM-only runtime-await fallback for DCA.
JVM-only runtime-await fallback for DCA.
The DCA macro rewrites .block into flatMap/map chains for all positions it understands (sequential, if, while, try/catch, match, and higher-order calls that have an AsyncShift). For the residual cases it cannot rewrite — e.g. an .block inside a plain user lambda with no shift — it falls back to this instance, which drives the Async to its value by blocking the calling thread (Loom-friendly, via the same parker as Async.block).
There is deliberately no equivalent on JS: a non-rewritable .block there is a compile error, since JavaScript cannot block.
This is not a cps.CpsRuntimeAsyncAwait — providing only the plain CpsRuntimeAwait keeps the macro rewrite as the primary path and uses blocking strictly as a last resort.
Attributes
- Source
- AsyncRuntimeAwait.scala