FSharpx.Extras


Choice

Namespace: FSharpx

Nested types and modules

TypeDescription
EitherBuilder

Functions and values

Function or valueDescription
( *> ) a b
Signature: a:Choice<'?12456,'?12457> -> b:Choice<'?12458,'?12457> -> Choice<'?12458,'?12457>
Type parameters: '?12456, '?12457, '?12458

Sequence actions, discarding the value of the first argument.

CompiledName: op_MultiplyGreater

( <!> ) f x
Signature: f:('?12447 -> '?12448) -> x:Choice<'?12447,'?12449> -> Choice<'?12448,'?12449>
Type parameters: '?12447, '?12448, '?12449

Infix map

CompiledName: op_LessBangGreater

( <* ) a b
Signature: a:Choice<'?12460,'?12461> -> b:Choice<'?12462,'?12461> -> Choice<'?12460,'?12461>
Type parameters: '?12460, '?12461, '?12462

Sequence actions, discarding the value of the second argument.

CompiledName: op_LessMultiply

( <*> ) f x
Signature: f:Choice<('?12439 -> '?12440),'?12441> -> x:Choice<'?12439,'?12441> -> Choice<'?12440,'?12441>
Type parameters: '?12439, '?12440, '?12441

Sequential application

CompiledName: op_LessMultiplyGreater

( <=< ) x
Signature: x:('?12485 -> Choice<'?12486,'?12487>) -> ('?12488 -> Choice<'?12485,'?12487>) -> '?12488 -> Choice<'?12486,'?12487>
Type parameters: '?12485, '?12486, '?12487, '?12488

Right-to-left Kleisli composition

CompiledName: op_LessEqualsLess

( =<< ) f m
Signature: f:('?12472 -> Choice<'?12473,'?12474>) -> m:Choice<'?12472,'?12474> -> Choice<'?12473,'?12474>
Type parameters: '?12472, '?12473, '?12474

Flipped >>=

CompiledName: op_EqualsLessLess

( >=> ) f g x
Signature: f:('?12480 -> Choice<'?12481,'?12482>) -> g:('?12481 -> Choice<'?12483,'?12482>) -> x:'?12480 -> Choice<'?12483,'?12482>
Type parameters: '?12480, '?12481, '?12482, '?12483

Left-to-right Kleisli composition

CompiledName: op_GreaterEqualsGreater

( >>. ) m1 m2
Signature: m1:Choice<'?12476,'?12477> -> m2:Choice<'?12478,'?12477> -> Choice<'?12478,'?12477>
Type parameters: '?12476, '?12477, '?12478

Sequentially compose two either actions, discarding any value produced by the first

CompiledName: op_GreaterGreaterDot

( >>= ) m f
Signature: m:Choice<'?12468,'?12469> -> f:('?12468 -> Choice<'?12470,'?12469>) -> Choice<'?12470,'?12469>
Type parameters: '?12468, '?12469, '?12470

Sequentially compose two actions, passing any value produced by the first as an argument to the second.

CompiledName: op_GreaterGreaterEquals

ap x f
Signature: x:Choice<'d,'e> -> f:Choice<('d -> 'f),'e> -> Choice<'f,'e>
Type parameters: 'd, 'e, 'f

Sequential application

bimap f1 f2 _arg1
Signature: f1:('d -> 'e) -> f2:('f -> 'g) -> _arg1:Choice<'d,'f> -> Choice<'e,'g>
Type parameters: 'd, 'e, 'f, 'g

Maps both parts of a Choice. Applies the first function if Choice is 1Of2. Otherwise applies the second function

bind f _arg1
Signature: f:('d -> Choice<'e,'f>) -> _arg1:Choice<'d,'f> -> Choice<'e,'f>
Type parameters: 'd, 'e, 'f

Monadic bind

cast o
Signature: o:obj -> Choice<'b,exn>
Type parameters: 'b

Attempts to cast an object. Stores the cast value in 1Of2 if successful, otherwise stores the exception in 2Of2

choice f1 f2 _arg1
Signature: f1:('d -> 'e) -> f2:('f -> 'e) -> _arg1:Choice<'d,'f> -> 'e
Type parameters: 'd, 'e, 'f

Maps both parts of a Choice. Applies the first function if Choice is 1Of2. Otherwise applies the second function

choose
Signature: EitherBuilder
foldM f s
Signature: f:('?12520 -> '?12521 -> Choice<'?12520,'?12522>) -> s:'?12520 -> seq<'?12521> -> Choice<'?12520,'?12522>
Type parameters: '?12520, '?12521, '?12522
get _arg1
Signature: _arg1:Choice<'c,'d> -> 'c
Type parameters: 'c, 'd

If Choice is 1Of2, return its value. Otherwise throw ArgumentException.

getOrRaise c
Signature: c:Choice<'a,'exn> -> 'a
Type parameters: 'a, 'exn

If Choice is 1Of2, return its value. Otherwise raise the exception in 2Of2.

getOrReraise c
Signature: c:Choice<'a,'exn> -> 'a
Type parameters: 'a, 'exn

If Choice is 1Of2, return its value. Otherwise reraise the exception in 2Of2.

lift2 f a b
Signature: f:('e -> 'f -> 'g) -> a:Choice<'e,'h> -> b:Choice<'f,'h> -> Choice<'g,'h>
Type parameters: 'e, 'f, 'g, 'h

Promote a function to a monad/applicative, scanning the monadic/applicative arguments from left to right.

map f _arg1
Signature: f:('d -> 'e) -> _arg1:Choice<'d,'f> -> Choice<'e,'f>
Type parameters: 'd, 'e, 'f

Transforms a Choice's first value by using a specified mapping function.

mapM f x
Signature: f:('?12527 -> Choice<'?12528,'?12529>) -> x:'?12527 list -> Choice<'?12528 list,'?12529>
Type parameters: '?12527, '?12528, '?12529
mapSecond f
Signature: f:('d -> 'e) -> Choice<'f,'d> -> Choice<'f,'e>
Type parameters: 'd, 'e, 'f

Transforms a Choice's second value by using a specified mapping function.

ofOption o _arg1
Signature: o:'?12517 -> _arg1:'?12518 option -> Choice<'?12518,'?12517>
Type parameters: '?12517, '?12518

If Some value, returns Choice1Of2 value. Otherwise, returns the supplied default value.

protect f x
Signature: f:('c -> 'd) -> x:'c -> Choice<'d,exn>
Type parameters: 'c, 'd

Wraps a function, encapsulates any exception thrown within to a Choice

returnM arg0
Signature: arg0:'f -> Choice<'f,'g>
Type parameters: 'f, 'g

Inject a value into the Choice type

sequence s
Signature: s:Choice<'c,'d> list -> Choice<'c list,'d>
Type parameters: 'c, 'd
toOption
Signature: Choice<'?12514,'?12515> -> '?12514 option
Type parameters: '?12514, '?12515

If Choice is 1Of2, returns Some value. Otherwise, returns None.

Fork me on GitHub