A symbolic alias for zipParRight
.
A symbolic alias for zipRight
.
A symbolic alias for zipParLeft
.
A symbolic alias for zipPar
.
A symbolic alias for zipLeft
.
A symbolic alias for zip
.
A symbolic alias for flatMap
.
Syntax for adding aspects.
Returns a query which submerges the error case of Either
into the error channel of the query
Returns a query which submerges the error case of Either
into the error channel of the query
The inverse of ZQuery.either
Maps the success value of this query to the specified constant value.
Lifts the error channel into a Some
value for composition with other optional queries
Lifts the error channel into a Some
value for composition with other optional queries
Returns a query whose failure and success channels have been mapped by the
specified pair of functions, f
and g
.
Recovers from all errors.
Recovers from all errors with provided Cause.
Recovers from all errors with provided Cause.
ZQuery.sandbox - other functions that can recover from defects
Moves a None
value in the error channel into the value channel while converting the existing value into a Some
Moves a None
value in the error channel into the value channel while converting the existing value into a Some
Inverse of ZQuery.some
Returns a query whose failure and success have been lifted into an
Either
.
Returns a query whose failure and success have been lifted into an
Either
. The resulting query cannot fail, because the failure case has
been exposed as part of the Either
success case.
Returns a query that models execution of this query, followed by passing its result to the specified function that returns a query.
Returns a query that models execution of this query, followed by passing
its result to the specified function that returns a query. Requests
composed with flatMap
or combinators derived from it will be executed
sequentially and will not be pipelined, though deduplication and caching of
requests may still be applied.
Returns a query that performs the outer query first, followed by the inner query, yielding the value of the inner query.
Returns a query that performs the outer query first, followed by the inner query, yielding the value of the inner query.
This method can be used to "flatten" nested queries.
Folds over the failed or successful result of this query to yield a query
that does not fail, but succeeds with the value returned by the left or
right function passed to fold
.
A more powerful version of foldM
that allows recovering from any type
of failure except interruptions.
Recovers from errors by accepting one query to execute for the case of an error, and one query to execute for the case of success.
Returns a successful query if the value is Left
, or fails with the error None
.
Returns a successful query if the value is Left
, or fails with the error e.
Returns a successful query if the value is Left
, or fails with the given error function 'e'.
Maps the specified function over the successful result of this query.
Transforms all data sources with the specified data source aspect.
Maps the specified function over the failed result of this query.
Returns a query with its full cause of failure mapped using the specified function.
Returns a query with its full cause of failure mapped using the
specified function. This can be used to transform errors while
preserving the original structure of Cause
.
sandbox, catchAllCause - other functions for dealing with defects
Maps the specified effectual function over the result of this query.
Converts this query to one that returns Some
if data sources return
results for all requests received and None
otherwise.
Converts this query to one that dies if a query failure occurs.
Converts this query to one that dies if a query failure occurs, using the
specified function to map the error to a Throwable
.
Provides this query with its required environment.
Provides the part of the environment that is not part of the ZEnv
,
leaving a query that only depends on the ZEnv
.
Provides a layer to this query, which translates it to another level.
Provides this query with part of its required environment.
Splits the environment into two parts, providing one part using the
specified layer and leaving the remainder R0
.
Keeps some of the errors, and terminates the query with the rest
Keeps some of the errors, and terminates the query with the rest, using
the specified function to convert the E
into a Throwable
.
Returns a successful effect if the value is Right
, or fails with the error None
.
Returns a successful effect if the value is Right
, or fails with the given error 'e'.
Returns a successful effect if the value is Right
, or fails with the given error function 'e'.
Returns an effect that models executing this query.
Returns an effect that models executing this query with the specified cache.
Returns an effect that models executing this query, returning the query result along with the cache.
Expose the full cause of failure of this query
Companion helper to sandbox
.
Companion helper to sandbox
. Allows recovery, and partial recovery, from
errors and defects alike, as in:
Extracts a Some value into the value channel while moving the None into the error channel for easier composition
Extracts a Some value into the value channel while moving the None into the error channel for easier composition
Inverse of ZQuery.collectSome
Extracts the optional value or fails with the given error e
.
Summarizes a query by computing some value before and after execution, and then combining the values to produce a summary, together with the result of execution.
Returns a new query that executes this one and times the execution.
Takes some fiber failures and converts them into errors.
Takes some fiber failures and converts them into errors.
Takes some fiber failures and converts them into errors, using the
specified function to convert the E
into an E1
.
Returns a query that models the execution of this query and the specified query sequentially, combining their results into a tuple.
Returns a query that models the execution of this query and the specified query, batching requests to data sources and combining their results into a tuple.
Returns a query that models the execution of this query and the specified query, batching requests to data sources and returning the result of this query.
Returns a query that models the execution of this query and the specified query, batching requests to data sources and returning the result of the specified query.
Returns a query that models the execution of this query and the specified query sequentially, returning the result of this query.
Returns a query that models the execution of this query and the specified query in parallel, combining their results into a tuple.
Returns a query that models the execution of this query and the specified query in parallel, returning the result of this query.
Returns a query that models the execution of this query and the specified query in parallel, returning the result of the specified query.
Returns a query that models the execution of this query and the specified query sequentially, returning the result of the specified query.
Returns a query that models the execution of this query and the specified query sequentially, combining their results with the specified function.
Returns a query that models the execution of this query and the specified
query sequentially, combining their results with the specified function.
Requests composed with zipWith
or combinators derived from it will
automatically be pipelined.
Returns a query that models the execution of this query and the specified query, batching requests to data sources.
Returns a query that models the execution of this query and the specified query in parallel, combining their results with the specified function.
Returns a query that models the execution of this query and the specified
query in parallel, combining their results with the specified function.
Requests composed with zipWithPar
or combinators derived from it will
automatically be batched.
A
ZQuery[R, E, A]
is a purely functional description of an effectual query that may contain requests from one or more data sources, requires an environmentR
, and may fail with anE
or succeed with anA
.Requests that can be performed in parallel, as expressed by
zipWithPar
and combinators derived from it, will automatically be batched. Requests that must be performed sequentially, as expressed byzipWith
and combinators derived from it, will automatically be pipelined. This allows for aggressive data source specific optimizations. Requests can also be deduplicated and cached.This allows for writing queries in a high level, compositional style, with confidence that they will automatically be optimized. For example, consider the following query from a user service.
This would normally require N + 1 queries, one for
getAllUserIds
and one for each call togetUserNameById
. In contrast,ZQuery
will automatically optimize this to two queries, one foruserIds
and one foruserNames
, assuming an implementation of the user service that supports batching.Based on "There is no Fork: an Abstraction for Efficient, Concurrent, and Concise Data Access" by Simon Marlow, Louis Brandy, Jonathan Coens, and Jon Purdy. http://simonmar.github.io/bib/papers/haxl-icfp14.pdf