Chessie


Rop

Contains functions and a compuation expression build for Railway-oriented programming.

Nested types and modules

TypeDescription
RopBuilder

Builder type for railway-oriented computation expressions.

RopResult<'TSuccess, 'TMessage>

Railway-oriented programming result - represents the result of a computation

Functions and values

Function or valueDescription
( <!> ) f result
Signature: f:('?6155 -> '?6156) -> result:RopResult<'?6155,'?6157> -> RopResult<'?6156,'?6157>
Type parameters: '?6155, '?6156, '?6157

Lifts a function into a RopResult and applies it on the given result. Infix version of Rop.lift

( <*> ) wrappedFunction result
Signature: wrappedFunction:RopResult<('?6147 -> '?6148),'?6149> -> result:RopResult<'?6147,'?6149> -> RopResult<'?6148,'?6149>
Type parameters: '?6147, '?6148, '?6149

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. Infix version of Rop.apply

( >>= ) result f
Signature: result:RopResult<'?6139,'?6140> -> f:('?6139 -> RopResult<'?6141,'?6140>) -> RopResult<'?6141,'?6140>
Type parameters: '?6139, '?6140, '?6141

If the result is a Success it executes the given function on the value. Otherwise the exisiting failure is propagated. Infix version of Rop.bind

apply wrappedFunction result
Signature: wrappedFunction:RopResult<('?6143 -> '?6144),'?6145> -> result:RopResult<'?6143,'?6145> -> RopResult<'?6144,'?6145>
Type parameters: '?6143, '?6144, '?6145

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.

bind f result
Signature: f:('?6135 -> RopResult<'?6136,'?6137>) -> result:RopResult<'?6135,'?6137> -> RopResult<'?6136,'?6137>
Type parameters: '?6135, '?6136, '?6137

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

collect xs
Signature: xs:seq<RopResult<'?6165,'?6166>> -> RopResult<'?6165 list,'?6166>
Type parameters: '?6165, '?6166

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

either fSuccess fFailure ropResult
Signature: fSuccess:('?6125 * '?6126 list -> '?6127) -> fFailure:('?6126 list -> '?6127) -> ropResult:RopResult<'?6125,'?6126> -> '?6127
Type parameters: '?6125, '?6126, '?6127

Takes a RopResult and maps it with fSuccess if it is a Success otherwise it maps it with fFailure.

fail msg
Signature: msg:'?6122 -> RopResult<'?6123,'?6122>
Type parameters: '?6122, '?6123

Wraps a message in a Failure

failIfNone message result
Signature: message:'?6168 -> result:'?6169 option -> RopResult<'?6169,'?6168>
Type parameters: '?6168, '?6169

Converts an option into a RopResult.

failureTee f result
Signature: f:('?6162 list -> unit) -> result:RopResult<'?6163,'?6162> -> RopResult<'?6163,'?6162>
Type parameters: '?6162, '?6163

If the result is a Failure it executes the given function on the value and the messages. Otherwise the exisiting successful value is propagated.

lift f result
Signature: f:('?6151 -> '?6152) -> result:RopResult<'?6151,'?6153> -> RopResult<'?6152,'?6153>
Type parameters: '?6151, '?6152, '?6153

Lifts a function into a RopResult and applies it on the given result.

mergeMessages msgs result
Signature: msgs:'?6132 list -> result:RopResult<'?6133,'?6132> -> RopResult<'?6133,'?6132>
Type parameters: '?6132, '?6133

Appends the given messages with the messages in the given result.

returnOrFail result
Signature: result:RopResult<'?6129,'?6130> -> '?6129
Type parameters: '?6129, '?6130

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.

rop
Signature: RopBuilder

Railway-oriented computation expressions.

succeed x
Signature: x:'?6119 -> RopResult<'?6119,'?6120>
Type parameters: '?6119, '?6120

Wraps a value in a Success

successTee f result
Signature: f:('?6159 * '?6160 list -> unit) -> result:RopResult<'?6159,'?6160> -> RopResult<'?6159,'?6160>
Type parameters: '?6159, '?6160

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

Fork me on GitHub