faulty

inline fun <T : Any> T.faulty(isFailure: T.() -> Boolean): Faulty<T>

Wraps a value of type T as a Faulty based on a isFailure.

If the isFailure returns true, the value is wrapped as a Failure. If the isFailure returns false, an emptySuccess is returned.

Return

A Faulty containing the value as a Failure or an emptySuccess.

Parameters

T

The type of the value to wrap.

isFailure

A function that determines if the value is a failure.


Wrap any T as a Faulty.

Return

A Faulty containing the value as a Failure or an emptySuccess.

Parameters

T

The type of the value to wrap.