Turns any success whose underlying value doesn't validate the specified predicate into a failure.
Turns any success whose underlying value doesn't validate the specified predicate into a failure.
This is useful when not all successes are interesting. One might receive, for example, a success containing an int, but need to further reduce its domain to positive ints and turn any other into a failure.
Returns the result of applying the specified predicate to the underlying value if a success, false
otherwise.
Returns the result of applying the specified predicate to the underlying value if a success, false
otherwise.
Applies the specified procedure on the underlying value if a success, does nothing otherwise.
Returns the underlying value if a success, throws an exception otherwise.
Returns the underlying value if a success, the specified default value otherwise.
Returns true
if the result is a failure.
Returns true
if the result is a failure.
Returns true
if the result is a success.
Returns the specified default value if a failure, does nothing otherwise.
Turns any failure whose value is defined for specified partial function into a success with the corresponding value.
Turns any failure whose value is defined for specified partial function into a success with the corresponding value.
This is useful when some error conditions are actually valid answers - one could imagine, for instance, that
failure to parse a boolean could be turned into a successful parsing of false
.
Turns any failure whose value is defined for specified partial function into the corresponding value.
Turns any failure whose value is defined for specified partial function into the corresponding value.
This is useful when some error conditions have fallback solutions - one could imagine, for instance, that failure to parse a file because it does not exist can be retried on a secondary possible location for the file.
Turns a success into a singleton list and a failure into an empty list.
Returns the underlying value if a success, the result of applying the specified function to the failure value otherwise.