Chessie


ResultExtensions

Namespace: Chessie.ErrorHandling.CSharp

Extensions methods for easier C# usage.

Constructors

ConstructorDescription
new()
Signature: unit -> ResultExtensions

CompiledName: .ctor

Static members

Static memberDescription
Collect(values)
Signature: values:seq<Result<'TSuccess,'TMessage>> -> Result<'TSuccess list,'TMessage>
Type parameters: 'TSuccess, 'TMessage

Collects a sequence of Results and accumulates their values. If the sequence contains an error the error will be propagated.

Either(this, ifSuccess, ifFailure)
Signature: (this:Result<'TSuccess,'TMessage> * ifSuccess:Func<'TSuccess,'TMessage list,'TResult> * ifFailure:Func<'TMessage list,'TResult>) -> 'TResult
Type parameters: 'TSuccess, 'TMessage, 'TResult

Allows pattern matching on Results from C#.

FailedWith(this)
Signature: this:Result<'TSuccess,'TMessage> -> 'TMessage list
Type parameters: 'TSuccess, 'TMessage

Returns the error messages or fails if the result was a success.

Flatten(this)
Signature: this:Result<seq<Result<'TSuccess,'TMessage>>,'TMessage> -> Result<seq<'TSuccess>,'TMessage>
Type parameters: 'TSuccess, 'TMessage

Collects a sequence of Results and accumulates their values. If the sequence contains an error the error will be propagated.

Join(...)
Signature: (this:Result<'TOuter,'TMessage> * inner:Result<'TInner,'TMessage> * _outerKeySelector:Func<'TOuter,'TKey> * _innerKeySelector:Func<'TInner,'TKey> * resultSelector:Func<'TOuter,'TInner,'TResult>) -> Result<'TResult,'TMessage>
Type parameters: 'TOuter, 'TMessage, 'TInner, 'TKey, 'TResult

Joins two results. If both are a success the resultSelector Func is applied to the values and the existing success messages are propagated. Otherwise the exisiting error messages are propagated.

Map(this, func)
Signature: (this:Result<'TSuccess,'TMessage> * func:Func<'TSuccess,'?7400>) -> Result<'?7400,'TMessage>
Type parameters: 'TSuccess, 'TMessage, '?7400

Lifts a Func into a Result and applies it on the given result.

MapFailure(this, f)
Signature: (this:Result<'TSuccess,'TMessage> * f:Func<'TMessage list,seq<'TMessage2>>) -> Result<'TSuccess,'TMessage2>
Type parameters: 'TSuccess, 'TMessage, 'TMessage2

Maps a function over the existing error messages in case of failure. In case of success, the message type will be changed and warnings will be discarded.

Match(this, ifSuccess, ifFailure)
Signature: (this:Result<'TSuccess,'TMessage> * ifSuccess:Action<'TSuccess,'TMessage list> * ifFailure:Action<'TMessage list>) -> unit
Type parameters: 'TSuccess, 'TMessage

Allows pattern matching on Results from C#.

Select(this, func)
Signature: (this:Result<'TSuccess,'TMessage> * func:Func<'TSuccess,'?7419>) -> Result<'?7419,'TMessage>
Type parameters: 'TSuccess, 'TMessage, '?7419

Lifts a Func into a Result and applies it on the given result.

SelectMany(this, func, mapper)
Signature: (this:Result<'TSuccess,'TMessage> * func:Func<'TSuccess,Result<'?7414,'TMessage>> * mapper:Func<'TSuccess,'?7414,'?7415>) -> Result<'?7415,'TMessage>
Type parameters: 'TSuccess, 'TMessage, '?7414, '?7415

If the result is a Success it executes the given Func on the value. If the result of the Func is a Success it maps it using the given Func. Otherwise the exisiting failure is propagated.

SelectMany(this, func)
Signature: (this:Result<'TSuccess,'TMessage> * func:Func<'TSuccess,Result<'?7410,'TMessage>>) -> Result<'?7410,'TMessage>
Type parameters: 'TSuccess, 'TMessage, '?7410

If the result is a Success it executes the given Func on the value. Otherwise the exisiting failure is propagated.

SucceededWith(this)
Signature: this:Result<'TSuccess,'TMessage> -> 'TSuccess
Type parameters: 'TSuccess, 'TMessage

Returns the result or fails if the result was an error.

ToResult(this, msg)
Signature: (this:'?7433 option * msg:'?7434) -> Result<'?7433,'?7434>
Type parameters: '?7433, '?7434

Converts an option into a Result.

Fork me on GitHub