CompleteIfSome

h8io.stages.operators.CompleteIfSome
object CompleteIfSome extends Stage[Any, Any, Nothing] => Stage[Any, Any, Nothing]

A h8io.stages.base.Decoration that stops the pipeline as soon as the decorated stage produces an output value.

CompleteIfSome appends h8io.stages.std.Complete after the decorated stage via ~>. If the stage yields h8io.stages.Yield.Some, Complete immediately emits h8io.stages.Status.Complete, terminating the pipeline. If the stage yields h8io.stages.Yield.None, Complete is not reached and the pipeline continues normally.

The singleton operates on Stage[Any, Any, Nothing] and can be cast to any concrete Decoration[I, O, E] via apply[I, O, E].

Example:

val stage: Stage[Int, Int, Nothing] = ...
val completing: Stage[Int, Int, Nothing] = CompleteIfSome(stage)
// Once stage produces a value, the pipeline stops.

Attributes

Graph
Supertypes
trait Stage[Any, Any, Nothing] => Stage[Any, Any, Nothing]
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

def apply[I, O, E]: Stage[I, O, E] => Stage[I, O, E]

Returns a typed view of this singleton as a Decoration[I, O, E].

Returns a typed view of this singleton as a Decoration[I, O, E].

Type parameters

E

the error type

I

the input type

O

the output type

Attributes

override def apply(stage: Stage[Any, Any, Nothing]): Stage[Any, Any, Nothing]

Applies the body of this function to the argument.

Applies the body of this function to the argument.

Value parameters

v1

the function argument

Attributes

Returns

the result of function application.

Definition Classes
Function1

Inherited methods

def andThen[A](g: Stage[Any, Any, Nothing] => A): Stage[Any, Any, Nothing] => A

Composes two instances of Function1 in a new Function1, with this function applied first.

Composes two instances of Function1 in a new Function1, with this function applied first.

Type parameters

A

the result type of function g

Value parameters

g

a function R => A

Attributes

Returns

a new function f such that f(x) == g(apply(x))

Inherited from:
Function1
def compose[A](g: A => Stage[Any, Any, Nothing]): A => Stage[Any, Any, Nothing]

Composes two instances of Function1 in a new Function1, with this function applied last.

Composes two instances of Function1 in a new Function1, with this function applied last.

Type parameters

A

the type to which function g can be applied

Value parameters

g

a function A => T1

Attributes

Returns

a new function f such that f(x) == apply(g(x))

Inherited from:
Function1
override def toString(): String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns

a string representation of the object.

Definition Classes
Function1 -> Any
Inherited from:
Function1