![]() |
BadScript 2
|
Static Public Member Functions | |
static Result< TSuccess, TMessage > | Ok< TSuccess, TMessage > (TSuccess value) |
Wraps a value in a Success. | |
static Result< TSuccess, TMessage > | Pass< TSuccess, TMessage > (TSuccess value) |
Wraps a value in a Success. | |
static Result< TSuccess, TMessage > | Warn< TSuccess, TMessage > (TMessage message, TSuccess value) |
Wraps a value in a Success and adds a message. | |
static Result< TSuccess, TMessage > | Fail< TSuccess, TMessage > (TMessage message) |
Wraps a message in a Failure. | |
static bool | Failed< TSuccess, TMessage > (Result< TSuccess, TMessage > result) |
Returns true if the result was not successful. | |
static TResult | Either< TSuccess, TMessage, TResult > (Func< TSuccess, IEnumerable< TMessage >, TResult > successFunc, Func< IEnumerable< TMessage >, TResult > failureFunc, Result< TSuccess, TMessage > trialResult) |
Takes a Result and maps it with successFunc if it is a Success otherwise it maps it with failureFunc. | |
static TSuccess | ReturnOrFail< TSuccess, TMessage > (Result< TSuccess, TMessage > result) |
If the given result is a Success the wrapped value will be returned. Otherwise the function throws an exception with Failure message of the result. | |
static Result< TSuccess, TMessage > | MergeMessages< TSuccess, TMessage > (IEnumerable< TMessage > messages, Result< TSuccess, TMessage > result) |
Appends the given messages with the messages in the given result. | |
static Result< TSuccess, TMessage > | Bind< TValue, TSuccess, TMessage > (Func< TValue, Result< TSuccess, TMessage > > func, Result< TValue, TMessage > result) |
If the result is a Success it executes the given function on the value. Otherwise the exisiting failure is propagated. | |
static Result< TSuccess, TMessage > | Flatten< TSuccess, TMessage > (Result< Result< TSuccess, TMessage >, TMessage > result) |
Flattens a nested result given the Failure types are equal. | |
static Result< TSuccess, TMessage > | Apply< TValue, TSuccess, TMessage > (Result< Func< TValue, TSuccess >, TMessage > wrappedFunction, Result< TValue, TMessage > result) |
If the wrapped function is a success and the given result is a success the function is applied on the value. Otherwise the exisiting error messages are propagated. | |
static Result< TSuccess, TMessage > | Lift< TValue, TSuccess, TMessage > (Func< TValue, TSuccess > func, Result< TValue, TMessage > result) |
Lifts a function into a Result container and applies it on the given result. | |
static Result< TSuccess1, TMessage1 > | Lift2< TSuccess, TMessage, TSuccess1, TMessage1 > (Func< TSuccess, Func< TMessage, TSuccess1 > > func, Result< TSuccess, TMessage1 > first, Result< TMessage, TMessage1 > second) |
Promote a function to a monad/applicative, scanning the monadic/applicative arguments from left to right. | |
static Result< IEnumerable< TSuccess >, TMessage > | Collect< TSuccess, TMessage > (IEnumerable< Result< TSuccess, TMessage > > xs) |
Collects a sequence of Results and accumulates their values. If the sequence contains an error the error will be propagated. | |
Definition at line 209 of file ErrorHandling.cs.
|
static |
If the wrapped function is a success and the given result is a success the function is applied on the value. Otherwise the exisiting error messages are propagated.
Definition at line 401 of file ErrorHandling.cs.
|
static |
If the result is a Success it executes the given function on the value. Otherwise the exisiting failure is propagated.
Definition at line 364 of file ErrorHandling.cs.
|
static |
Collects a sequence of Results and accumulates their values. If the sequence contains an error the error will be propagated.
Definition at line 469 of file ErrorHandling.cs.
|
static |
Takes a Result and maps it with successFunc if it is a Success otherwise it maps it with failureFunc.
Definition at line 284 of file ErrorHandling.cs.
|
static |
Wraps a message in a Failure.
Definition at line 257 of file ErrorHandling.cs.
|
static |
Returns true if the result was not successful.
Definition at line 273 of file ErrorHandling.cs.
|
static |
Flattens a nested result given the Failure types are equal.
Definition at line 388 of file ErrorHandling.cs.
|
static |
Promote a function to a monad/applicative, scanning the monadic/applicative arguments from left to right.
Definition at line 454 of file ErrorHandling.cs.
|
static |
Lifts a function into a Result container and applies it on the given result.
Definition at line 442 of file ErrorHandling.cs.
|
static |
Appends the given messages with the messages in the given result.
Definition at line 337 of file ErrorHandling.cs.
|
static |
Wraps a value in a Success.
Definition at line 217 of file ErrorHandling.cs.
|
static |
Wraps a value in a Success.
Definition at line 228 of file ErrorHandling.cs.
|
static |
If the given result is a Success the wrapped value will be returned. Otherwise the function throws an exception with Failure message of the result.
Definition at line 318 of file ErrorHandling.cs.
|
static |
Wraps a value in a Success and adds a message.
Definition at line 239 of file ErrorHandling.cs.