scoop:scoop.std:0.1.0
scoop
API
-
enum
Result
A value carrying either a successful result or an explicitly typed failure. See scoop example language/errors for composition that preserves the failure value.
-
function
errorOrNone
Returns the failure value as Some, or None on success.
-
function
filter
Keeps Some only if its value satisfies the predicate.
-
function
flatMap
Transforms Some with an Option-producing callback, leaving None unchanged. See scoop example language/option for a chain that preserves absence.
-
function
fold
Runs exactly the callback corresponding to the success or failure variant.
-
function
getOrElse
Returns the success value, or evaluates the failure callback.
-
function
getOrNone
Returns the successful value as Some, or None on failure.
-
function
getOrThrow
Returns the success value or throws the stored Throwable.
-
function
map
Transforms Success while propagating Failure unchanged.
-
function
mapError
Transforms Failure while propagating Success unchanged.
-
function
onFailure
Runs the action only for Failure and returns this result.
-
function
onSuccess
Runs the action only for Success and returns this result.
-
function
orElse
Keeps Some, evaluating the alternative Option only for None. See scoop example language/option for alternatives that retain an empty present value.
-
function
recover
Maps a failure into a success value, leaving Success unchanged.
-
function
runCatching
Runs the block and captures a thrown Throwable as Failure.
-
function
toOption
Keeps the success value and discards a failure into None.
-
function
toResult
Maps Some to Success, producing a failure only for None.