Used to delimit scope of effect(s).
Handler transforms a Computation, by discharging some or all of its requested effects, and (optionally) introducing handlers own dependencies to it (set of effects used to create the handler).
val myComputation2 = myComputation1.handleWith(myHandler)
Handlers can be obtained by:
- implementing an Interpreter for an Effect, and then calling
toHandler
method on it. - transforming a preexisting handler, e.g.
val myHandler2 = myHandler1.map(...)
- composing 2 preexisting handlers, e.g.
val myHandler3 = myHandler1 &&&! myHandler2
Compositon of 2 handlers is always sequential: the operands are applied in left to right order.
The From[_]
type parameter can only have 2 forms:
- type-level identity function:
[X] =>> X
- type-level constant function:
[_] =>> C
The To[_]
type parameter has no restrictions, but often happens to be identity.
Type parameters
- Elim
-
Type-level set of effects, that this handler eliminates from the computation.
- From
-
Type constructor, indicating what computation's result types can be accepted by this handler as input.
- Intro
-
Type-level set of effects, that this handler introduces into the computation. This is often an empty set, expressed as
Any
. - To
-
Type constructor (e.g.
Option[_]
), in which the computation's result is wrapped, after application of this handler.
Attributes
- Companion
- object
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
Members list
Type members
Classlikes
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
Value members
Concrete methods
Alias for partiallyProvideWith.
Alias for provideWith.
Alias for composeWith.
Composes 2 independent handlers, also flattening their nested Tuple2
results.
Composes 2 independent handlers, also flattening their nested Tuple2
results.
((_, S1), S2) ~> (_, (S1, S2))
((_, S1, S2), S3) ~> (_, (S1, S2, S3))
((_, S1, S2, S3), S4) ~> (_, (S1, S2, S3, S4))
...
Attributes
Composes 2 independent handlers.
Composes 2 independent handlers.
Independence of handlers means, that effects eliminated by one of the handlers, do not overlap with effects introduced by the other.
Independence of 2 handlers guarantees, that it's also valid to compose them in the opposite order. However, nesting order of their To[_]
s would also be reversed.
Attributes
Like contraMapK, but the pre-processing of From[_]
can also introduce effects.
Like contraMapK, but the pre-processing of From[_]
can also introduce effects.
Those effects are then absorbed by the new handler into the effects it introduces.
Attributes
Transforms this handler, by applying a pre-processing function to its input`.
Transforms this handler, by applying a pre-processing function to its input`.
Attributes
Like contraMapEffK, but the pre-processing is executed for its effects only.
Like contraMapEffK, but the pre-processing is executed for its effects only.
This handler's From[_]
remains unchanged.
Attributes
Transforms this handler, by dropping the second element of its Tuple2
result.
Transforms this handler, by dropping the second element of its Tuple2
result.
Attributes
Like flatMapLeft, but the mapping is executed for its effects only.
Like flatMapState, but the mapping is executed for its effects only.
Transforms this handler, by deconstructing its Option
result.
Transforms this handler, by deconstructing its Option
result.
Attributes
Transforms this handler, by deconstructing its Either
result.
Transforms this handler, by deconstructing its Either
result.
Attributes
Transforms this handler, by deconstructing its Option
result.
Transforms this handler, by deconstructing its Option
result.
Attributes
Transforms this handler, by deconstructing its Either
result.
Transforms this handler, by deconstructing its Either
result.
Attributes
Applies this handler to given computation.
Transforms this handler, by dropping the first element of its Tuple2
result.
Transforms this handler, by dropping the first element of its Tuple2
result.
Attributes
Transforms this handler, by applying a post-processing function to its result`.
Transforms this handler, by applying a post-processing function to its result`.
a.k.a Natural Transformation.
Attributes
Transforms this handler, by mapping the Left
branch of its Either
result.
Transforms this handler, by mapping the Left
branch of its Either
result.
Attributes
Transforms this handler, by mapping the second element of its Tuple2
result.
Transforms this handler, by mapping the second element of its Tuple2
result.
Attributes
Composes 2 partially dependent handlers.
Composes 2 partially dependent handlers.
Assumes that some of effects introduced by this handler, are eliminated by that
handler.
Attributes
Specializes this handler, making it applicable only to computations returning C
type.
Specializes this handler, making it applicable only to computations returning C
type.
Removes universal quantification of the handler over its input type.
Attributes
Composes 2 fully dependent handlers.
Composes 2 fully dependent handlers.
Assumes that all effects introduced by this handler, are eliminated by that
handler.
Attributes
Transforms this handler, by mapping its Option
result to Either
.
Transforms this handler, by mapping its Option
result to Either
.
Attributes
Transforms this handler, by mapping its Either
result to Option
.
Transforms this handler, by mapping its Either
result to Option
.
Attributes
Transforms this handler, by mapping its Option
result to Try
.
Transforms this handler, by mapping its Option
result to Try
.
Attributes
Transforms this handler, by mapping its Either
result to Try
.
Transforms this handler, by mapping its Either
result to Try
.
Attributes
Transforms this handler, by mapping its Option
result to Vector
.
Transforms this handler, by mapping its Option
result to Vector
.
Attributes
Transforms this handler, by deconstructing its Option
result.
Transforms this handler, by deconstructing its Option
result.
Attributes
Transforms this handler, by discarding its result.
Transforms this handler, by discarding its result.
Attributes
Composes 2 independent handlers, also flattening their nested Option
results.
Composes 2 independent handlers, also flattening their nested Option
results.
Option[Option[_]] ~> Option[_]
Attributes
Composes 2 independent handlers, also flattening their nested Either
results.
Composes 2 independent handlers, also flattening their nested Either
results.
Either[E2, Either[E1, _]] ~> Either[E1 | E2, _]