A symbolic alias for zip
.
Splits the environment, providing the first part to this computaiton and the second part to that computation.
A symbolic alias for zipRight
.
Runs this computation if the provided environment is a Left
or else
runs that computation if the provided environment is a Right
, returning
the result in an Either
.
A symbolic alias for zipLeft
.
A symbolic alias for zip
.
A symbolic alias for orElseEither
.
A symbolic alias for compose
.
A symbolic alias for orElse
.
A symbolic alias for flatMap
.
A symbolic alias for andThen
.
A symbolic alias for log
.
Submerges the error case of an Either
into the error type of this
computation.
Runs this computation and uses its result to provide the specified computation with its required environment.
Maps the success value of this computation to a constant value.
Maps the success value of this computation to the optional value.
Maps the error value of this computation to the optional value.
Maps the output state to a constant value
Returns a computation whose error and success channels have been mapped
by the specified functions, f
and g
.
Recovers from all errors.
Recovers from some or all of the error cases.
Transforms the result of this computation with the specified partial
function, failing with the e
value if the partial function is not
defined for the given input.
Transforms the result of this computation with the specified partial
function which returns a new computation, failing with the e
value if
the partial function is not defined for the given input.
Runs the specified computation and uses its result to provide this computation with its required environment.
Transforms the initial state of this computation with the specified function.
Returns a computation whose failure and success have been lifted into an
Either
.
Returns a computation whose failure and success have been lifted into an
Either
. The resulting computation cannot fail, because the failure case
has been exposed as part of the Either
success case.
Applies the specified function if the predicate fails.
Similar to filterOrElse
, but instead of a function it accepts the ZPure computation
to apply if the predicate fails.
Fails with the specified error if the predicate fails.
Extends this computation with another computation that depends on the result of this computation by running the first computation, using its result to generate a second computation, and running that computation.
Flattens a nested computation to a single computation by running the outer computation and then running the inner computation.
Swaps the error and success types of this computation.
Folds over the failed or successful results of this computation to yield
a computation that does not fail, but succeeds with the value of the left
or righr function passed to fold
.
Recovers from errors by accepting one computation to execute for the case of an error, and one computation to execute for the case of success.
Exposes the output state into the value channel.
Returns a successful computation with the head of the list if the list is
non-empty or fails with the error None
if the list is empty.
Runs this computation if the provided environment is a Left
or else
runs that computation if the provided environment is a Right
, unifying
the result to a common supertype.
Returns a successful computation if the value is Left
, or fails with error None
.
Returns a successful computation if the value is Left
, or fails with error e
.
Returns a successful computation if the value is Left
, or fails with the given error function e
.
Returns a successful computation if the value is Left
, or fails with a java.util.NoSuchElementException.
Transforms the result of this computation with the specified function.
Transforms the error type of this computation with the specified function.
Transforms the updated state of this computation with the specified function.
Negates the boolean value of this computation.
Requires the value of this computation to be None
, otherwise fails with None
.
Executes this computation and returns its value, if it succeeds, but otherwise executes the specified computation.
Executes this computation and returns its value, if it succeeds, but otherwise executes the specified computation.
Executes this computation and returns its value, if it succeeds, but otherwise fails with the specified error.
Executes this computation and returns its value, if it succeeds, but otherwise fallbacks to the new state with the specified value.
Returns an computation that will produce the value of this computation, unless it
fails with the None
value, in which case it will produce the value of
the specified computation.
Executes this computation and returns its value, if it succeeds, but otherwise succeeds with the specified value.
Provides this computation with its required environment.
Provides this computation with part of its required environment, leaving the remainder.
Provides this computation with its initial state.
Fail with the returned value if the PartialFunction
matches, otherwise
continue with our held value.
Continue with the returned computation if the PartialFunction
matches,
translating the successful match into a failure, otherwise continue with
our held value.
Repeats this computation the specified number of times (or until the first failure) passing the updated state to each successive repetition.
Repeats this computation until its value satisfies the specified predicate (or until the first failure) passing the updated state to each successive repetition.
Repeats this computation until its value is equal to the specified value (or until the first failure) passing the updated state to each successive repetition.
Repeats this computation until the updated state satisfies the specified predicate (or until the first failure) passing the updated state to each successive repetition.
Repeats this computation until the updated state is equal to the specified value (or until the first failure) passing the updated state to each successive repetition.
Repeats this computation for as long as its value satisfies the specified predicate (or until the first failure) passing the updated state to each successive repetition.
Repeats this computation for as long as its value is equal to the specified value (or until the first failure) passing the updated state to each successive repetition.
Repeats this computation for as long as the updated state satisfies the specified predicate (or until the first failure) passing the updated state to each successive repetition.
Returns a successful computation if the value is Right
, or fails with error None
.
Runs this computation with the specified initial state, returning both the updated state and the result.
Runs this computation to produce its result.
Runs this computation with the specified initial state, returning both the log and either all the failures that occurred or the updated state and the result.
Runs this computation to produce its result or the first failure to occur.
Runs this computation to produce its result and the log.
Runs this computation with the specified initial state, returning the result and discarding the updated state.
Runs this computation with the specified initial state, returning the updated state and discarding the result.
Exposes the full cause of failures of this computation.
Converts an option on values into an option on errors leaving the state unchanged.
Extracts the optional value or returns the given 'default' leaving the state unchanged.
Extracts the optional value or runs the specified computation passing the updated state from this computation.
Extracts the optional value or fails with the given error 'e'.
Extracts the optional value or fails with a java.util.NoSuchElementException leaving the state unchanged.
Maps the value of this computation to unit.
Submerges the full cause of failures of this computation.
Combines this computation with the specified computation, passing the updated state from this computation to that computation and combining the results of both into a tuple.
Combines this computation with the specified computation, passing the updated state from this computation to that computation and returning the result of this computation.
Combines this computation with the specified computation, passing the updated state from this computation to that computation and returning the result of that computation.
Combines this computation with the specified computation, passing the updated state from this computation to that computation and combining the results of both using the specified function.
A symbolic alias for join
.
ZPure[W, S1, S2, R, E, A]
is a purely functional description of a computation that requires an environmentR
and an initial stateS1
and may either fail with anE
or succeed with an updated stateS2
and anA
along with in either case a log with entries of typeW
. Because of its polymorphismZPure
can be used to model a variety of effects including context, state, failure, and logging.