FSharpx.Extras


Choice Module

Types

Type Description

EitherBuilder

Functions and values

Function or value Description

a *> b

Full Usage: a *> b

Parameters:
Returns: Choice<'c, 'b>
Modifiers: inline

Sequence actions, discarding the value of the first argument.

a : Choice<'a, 'b>
b : Choice<'c, 'b>
Returns: Choice<'c, 'b>

a <* b

Full Usage: a <* b

Parameters:
Returns: Choice<'a, 'b>
Modifiers: inline

Sequence actions, discarding the value of the second argument.

a : Choice<'a, 'b>
b : Choice<'c, 'b>
Returns: Choice<'a, 'b>

f <!> x

Full Usage: f <!> x

Parameters:
    f : 'a -> 'b
    x : Choice<'a, 'c>

Returns: Choice<'b, 'c>
Modifiers: inline

Infix map

f : 'a -> 'b
x : Choice<'a, 'c>
Returns: Choice<'b, 'c>

f <*> x

Full Usage: f <*> x

Parameters:
Returns: Choice<'b, 'c>
Modifiers: inline

Sequential application

f : Choice<('a -> 'b), 'c>
x : Choice<'a, 'c>
Returns: Choice<'b, 'c>

<=<x

Full Usage: <=<x

Parameters:
Returns: ('d -> Choice<'a, 'c>) -> 'd -> Choice<'b, 'c>
Modifiers: inline

Right-to-left Kleisli composition

x : 'a -> Choice<'b, 'c>
Returns: ('d -> Choice<'a, 'c>) -> 'd -> Choice<'b, 'c>

f =<< m

Full Usage: f =<< m

Parameters:
Returns: Choice<'b, 'c>
Modifiers: inline

Flipped >>=

f : 'a -> Choice<'b, 'c>
m : Choice<'a, 'c>
Returns: Choice<'b, 'c>

(>=>) f g x

Full Usage: (>=>) f g x

Parameters:
Returns: Choice<'d, 'c>
Modifiers: inline

Left-to-right Kleisli composition

f : 'a -> Choice<'b, 'c>
g : 'b -> Choice<'d, 'c>
x : 'a
Returns: Choice<'d, 'c>

m1 >>. m2

Full Usage: m1 >>. m2

Parameters:
Returns: Choice<'c, 'b>
Modifiers: inline

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

m1 : Choice<'a, 'b>
m2 : Choice<'c, 'b>
Returns: Choice<'c, 'b>

m >>= f

Full Usage: m >>= f

Parameters:
Returns: Choice<'c, 'b>
Modifiers: inline

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

m : Choice<'a, 'b>
f : 'a -> Choice<'c, 'b>
Returns: Choice<'c, 'b>

ap x f

Full Usage: ap x f

Parameters:
Returns: Choice<'f, 'e>

Sequential application

x : Choice<'d, 'e>
f : Choice<('d -> 'f), 'e>
Returns: Choice<'f, 'e>

bimap f1 f2 _arg1

Full Usage: bimap f1 f2 _arg1

Parameters:
    f1 : 'd -> 'e
    f2 : 'f -> 'g
    _arg1 : Choice<'d, 'f>

Returns: Choice<'e, 'g>
Modifiers: inline
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

f1 : 'd -> 'e
f2 : 'f -> 'g
_arg1 : Choice<'d, 'f>
Returns: Choice<'e, 'g>

bind f _arg1

Full Usage: bind f _arg1

Parameters:
Returns: Choice<'e, 'f>

Monadic bind

f : 'd -> Choice<'e, 'f>
_arg1 : Choice<'d, 'f>
Returns: Choice<'e, 'f>

cast o

Full Usage: cast o

Parameters:
    o : obj

Returns: Choice<'b, exn>
Modifiers: inline
Type parameters: 'b

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

o : obj
Returns: Choice<'b, exn>

choice f1 f2 _arg1

Full Usage: choice f1 f2 _arg1

Parameters:
    f1 : 'd -> 'e
    f2 : 'f -> 'e
    _arg1 : Choice<'d, 'f>

Returns: 'e
Modifiers: inline
Type parameters: 'd, 'e, 'f

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

f1 : 'd -> 'e
f2 : 'f -> 'e
_arg1 : Choice<'d, 'f>
Returns: 'e

choose

Full Usage: choose

Returns: EitherBuilder
Returns: EitherBuilder

foldM f s

Full Usage: foldM f s

Parameters:
    f : 'a -> 'b -> Choice<'a, 'c>
    s : 'a

Returns: 'b seq -> Choice<'a, 'c>
f : 'a -> 'b -> Choice<'a, 'c>
s : 'a
Returns: 'b seq -> Choice<'a, 'c>

get _arg1

Full Usage: get _arg1

Parameters:
Returns: 'c

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

_arg1 : Choice<'c, 'd>
Returns: 'c

getOrRaise c

Full Usage: getOrRaise c

Parameters:
Returns: 'a

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

c : Choice<'a, 'exn>
Returns: 'a

getOrReraise c

Full Usage: getOrReraise c

Parameters:
Returns: 'a

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

c : Choice<'a, 'exn>
Returns: 'a

isChoice1Of2 c

Full Usage: isChoice1Of2 c

Parameters:
Returns: bool
Modifiers: inline
Type parameters: 'a, 'b
c : Choice<'a, 'b>
Returns: bool

isChoice1Of3 c

Full Usage: isChoice1Of3 c

Parameters:
Returns: bool
Modifiers: inline
Type parameters: 'a, 'b, 'c
c : Choice<'a, 'b, 'c>
Returns: bool

isChoice1Of4 c

Full Usage: isChoice1Of4 c

Parameters:
Returns: bool
Modifiers: inline
Type parameters: 'a, 'b, 'c, 'd
c : Choice<'a, 'b, 'c, 'd>
Returns: bool

isChoice1Of5 c

Full Usage: isChoice1Of5 c

Parameters:
    c : Choice<'a, 'b, 'c, 'd, 'e>

Returns: bool
Modifiers: inline
Type parameters: 'a, 'b, 'c, 'd, 'e
c : Choice<'a, 'b, 'c, 'd, 'e>
Returns: bool

isChoice1Of6 c

Full Usage: isChoice1Of6 c

Parameters:
    c : Choice<'a, 'b, 'c, 'd, 'e, 'f>

Returns: bool
Modifiers: inline
Type parameters: 'a, 'b, 'c, 'd, 'e, 'f
c : Choice<'a, 'b, 'c, 'd, 'e, 'f>
Returns: bool

isChoice1Of7 c

Full Usage: isChoice1Of7 c

Parameters:
    c : Choice<'a, 'b, 'c, 'd, 'e, 'f, 'g>

Returns: bool
Modifiers: inline
Type parameters: 'a, 'b, 'c, 'd, 'e, 'f, 'g
c : Choice<'a, 'b, 'c, 'd, 'e, 'f, 'g>
Returns: bool

isChoice2Of2 c

Full Usage: isChoice2Of2 c

Parameters:
Returns: bool
Modifiers: inline
Type parameters: 'a, 'b
c : Choice<'a, 'b>
Returns: bool

isChoice2Of3 c

Full Usage: isChoice2Of3 c

Parameters:
Returns: bool
Modifiers: inline
Type parameters: 'a, 'b, 'c
c : Choice<'a, 'b, 'c>
Returns: bool

isChoice2Of4 c

Full Usage: isChoice2Of4 c

Parameters:
Returns: bool
Modifiers: inline
Type parameters: 'a, 'b, 'c, 'd
c : Choice<'a, 'b, 'c, 'd>
Returns: bool

isChoice2Of5 c

Full Usage: isChoice2Of5 c

Parameters:
    c : Choice<'a, 'b, 'c, 'd, 'e>

Returns: bool
Modifiers: inline
Type parameters: 'a, 'b, 'c, 'd, 'e
c : Choice<'a, 'b, 'c, 'd, 'e>
Returns: bool

isChoice2Of6 c

Full Usage: isChoice2Of6 c

Parameters:
    c : Choice<'a, 'b, 'c, 'd, 'e, 'f>

Returns: bool
Modifiers: inline
Type parameters: 'a, 'b, 'c, 'd, 'e, 'f
c : Choice<'a, 'b, 'c, 'd, 'e, 'f>
Returns: bool

isChoice2Of7 c

Full Usage: isChoice2Of7 c

Parameters:
    c : Choice<'a, 'b, 'c, 'd, 'e, 'f, 'g>

Returns: bool
Modifiers: inline
Type parameters: 'a, 'b, 'c, 'd, 'e, 'f, 'g
c : Choice<'a, 'b, 'c, 'd, 'e, 'f, 'g>
Returns: bool

isChoice3Of3 c

Full Usage: isChoice3Of3 c

Parameters:
Returns: bool
Modifiers: inline
Type parameters: 'a, 'b, 'c
c : Choice<'a, 'b, 'c>
Returns: bool

isChoice3Of4 c

Full Usage: isChoice3Of4 c

Parameters:
Returns: bool
Modifiers: inline
Type parameters: 'a, 'b, 'c, 'd
c : Choice<'a, 'b, 'c, 'd>
Returns: bool

isChoice3Of5 c

Full Usage: isChoice3Of5 c

Parameters:
    c : Choice<'a, 'b, 'c, 'd, 'e>

Returns: bool
Modifiers: inline
Type parameters: 'a, 'b, 'c, 'd, 'e
c : Choice<'a, 'b, 'c, 'd, 'e>
Returns: bool

isChoice3Of6 c

Full Usage: isChoice3Of6 c

Parameters:
    c : Choice<'a, 'b, 'c, 'd, 'e, 'f>

Returns: bool
Modifiers: inline
Type parameters: 'a, 'b, 'c, 'd, 'e, 'f
c : Choice<'a, 'b, 'c, 'd, 'e, 'f>
Returns: bool

isChoice3Of7 c

Full Usage: isChoice3Of7 c

Parameters:
    c : Choice<'a, 'b, 'c, 'd, 'e, 'f, 'g>

Returns: bool
Modifiers: inline
Type parameters: 'a, 'b, 'c, 'd, 'e, 'f, 'g
c : Choice<'a, 'b, 'c, 'd, 'e, 'f, 'g>
Returns: bool

isChoice4Of4 c

Full Usage: isChoice4Of4 c

Parameters:
Returns: bool
Modifiers: inline
Type parameters: 'a, 'b, 'c, 'd
c : Choice<'a, 'b, 'c, 'd>
Returns: bool

isChoice4Of5 c

Full Usage: isChoice4Of5 c

Parameters:
    c : Choice<'a, 'b, 'c, 'd, 'e>

Returns: bool
Modifiers: inline
Type parameters: 'a, 'b, 'c, 'd, 'e
c : Choice<'a, 'b, 'c, 'd, 'e>
Returns: bool

isChoice4Of6 c

Full Usage: isChoice4Of6 c

Parameters:
    c : Choice<'a, 'b, 'c, 'd, 'e, 'f>

Returns: bool
Modifiers: inline
Type parameters: 'a, 'b, 'c, 'd, 'e, 'f
c : Choice<'a, 'b, 'c, 'd, 'e, 'f>
Returns: bool

isChoice4Of7 c

Full Usage: isChoice4Of7 c

Parameters:
    c : Choice<'a, 'b, 'c, 'd, 'e, 'f, 'g>

Returns: bool
Modifiers: inline
Type parameters: 'a, 'b, 'c, 'd, 'e, 'f, 'g
c : Choice<'a, 'b, 'c, 'd, 'e, 'f, 'g>
Returns: bool

isChoice5Of5 c

Full Usage: isChoice5Of5 c

Parameters:
    c : Choice<'a, 'b, 'c, 'd, 'e>

Returns: bool
Modifiers: inline
Type parameters: 'a, 'b, 'c, 'd, 'e
c : Choice<'a, 'b, 'c, 'd, 'e>
Returns: bool

isChoice5Of6 c

Full Usage: isChoice5Of6 c

Parameters:
    c : Choice<'a, 'b, 'c, 'd, 'e, 'f>

Returns: bool
Modifiers: inline
Type parameters: 'a, 'b, 'c, 'd, 'e, 'f
c : Choice<'a, 'b, 'c, 'd, 'e, 'f>
Returns: bool

isChoice5Of7 c

Full Usage: isChoice5Of7 c

Parameters:
    c : Choice<'a, 'b, 'c, 'd, 'e, 'f, 'g>

Returns: bool
Modifiers: inline
Type parameters: 'a, 'b, 'c, 'd, 'e, 'f, 'g
c : Choice<'a, 'b, 'c, 'd, 'e, 'f, 'g>
Returns: bool

isChoice6Of6 c

Full Usage: isChoice6Of6 c

Parameters:
    c : Choice<'a, 'b, 'c, 'd, 'e, 'f>

Returns: bool
Modifiers: inline
Type parameters: 'a, 'b, 'c, 'd, 'e, 'f
c : Choice<'a, 'b, 'c, 'd, 'e, 'f>
Returns: bool

isChoice6Of7 c

Full Usage: isChoice6Of7 c

Parameters:
    c : Choice<'a, 'b, 'c, 'd, 'e, 'f, 'g>

Returns: bool
Modifiers: inline
Type parameters: 'a, 'b, 'c, 'd, 'e, 'f, 'g
c : Choice<'a, 'b, 'c, 'd, 'e, 'f, 'g>
Returns: bool

isChoice7Of7 c

Full Usage: isChoice7Of7 c

Parameters:
    c : Choice<'a, 'b, 'c, 'd, 'e, 'f, 'g>

Returns: bool
Modifiers: inline
Type parameters: 'a, 'b, 'c, 'd, 'e, 'f, 'g
c : Choice<'a, 'b, 'c, 'd, 'e, 'f, 'g>
Returns: bool

lift2 f a b

Full Usage: lift2 f a b

Parameters:
Returns: Choice<'g, 'h>
Modifiers: inline
Type parameters: 'e, 'f, 'g, 'h

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

f : 'e -> 'f -> 'g
a : Choice<'e, 'h>
b : Choice<'f, 'h>
Returns: Choice<'g, 'h>

map f _arg1

Full Usage: map f _arg1

Parameters:
    f : 'b -> 'c
    _arg1 : Choice<'b, 'd>

Returns: Choice<'c, 'd>

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

f : 'b -> 'c
_arg1 : Choice<'b, 'd>
Returns: Choice<'c, 'd>

mapM f x

Full Usage: mapM f x

Parameters:
    f : 'a -> Choice<'b, 'c>
    x : 'a list

Returns: Choice<'b list, 'c>
Modifiers: inline
f : 'a -> Choice<'b, 'c>
x : 'a list
Returns: Choice<'b list, 'c>

mapSecond f

Full Usage: mapSecond f

Parameters:
    f : 'd -> 'e

Returns: Choice<'f, 'd> -> Choice<'f, 'e>
Modifiers: inline
Type parameters: 'd, 'e, 'f

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

f : 'd -> 'e
Returns: Choice<'f, 'd> -> Choice<'f, 'e>

ofOption o _arg1

Full Usage: ofOption o _arg1

Parameters:
    o : 'a
    _arg1 : 'b option

Returns: Choice<'b, 'a>

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

o : 'a
_arg1 : 'b option
Returns: Choice<'b, 'a>

protect f x

Full Usage: protect f x

Parameters:
    f : 'c -> 'd
    x : 'c

Returns: Choice<'d, exn>
Modifiers: inline
Type parameters: 'c, 'd

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

f : 'c -> 'd
x : 'c
Returns: Choice<'d, exn>

returnM arg0

Full Usage: returnM arg0

Parameters:
    arg0 : 'd

Returns: Choice<'d, 'e>

Inject a value into the Choice type

arg0 : 'd
Returns: Choice<'d, 'e>

sequence s

Full Usage: sequence s

Parameters:
Returns: Choice<'c list, 'd>
Modifiers: inline
Type parameters: 'c, 'd
s : Choice<'c, 'd> list
Returns: Choice<'c list, 'd>

toOption

Full Usage: toOption

Returns: Choice<'a, 'b> -> 'a option

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

Returns: Choice<'a, 'b> -> 'a option