FSharpx.Extras


Result Module

Types

Type Description

ResultBuilder

Functions and values

Function or value Description

a *> b

Full Usage: a *> b

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

Sequence actions, discarding the value of the first argument.

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

a <* b

Full Usage: a <* b

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

Sequence actions, discarding the value of the second argument.

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

f <!> x

Full Usage: f <!> x

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

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

Infix map

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

f <*> x

Full Usage: f <*> x

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

Sequential application

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

<=<x

Full Usage: <=<x

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

Right-to-left Kleisli composition

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

f =<< m

Full Usage: f =<< m

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

Flipped >>=

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

(>=>) f g x

Full Usage: (>=>) f g x

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

Left-to-right Kleisli composition

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

m1 >>. m2

Full Usage: m1 >>. m2

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

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

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

m >>= f

Full Usage: m >>= f

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

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

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

ap x f

Full Usage: ap x f

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

Sequential application

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

bimap f1 f2 x

Full Usage: bimap f1 f2 x

Parameters:
    f1 : 'a -> 'b
    f2 : 'c -> 'd
    x : Result<'a, 'c>

Returns: Result<'b, 'd>
Modifiers: inline

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

f1 : 'a -> 'b
f2 : 'c -> 'd
x : Result<'a, 'c>
Returns: Result<'b, 'd>

cast o

Full Usage: cast o

Parameters:
    o : obj

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

Attempts to cast an object. Stores the cast value in Ok if successful, otherwise stores the exception in Error

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

defaultValue v result

Full Usage: defaultValue v result

Parameters:
    v : 'a
    result : Result<'a, 'b>

Returns: 'a
Modifiers: inline

Gets the value of result if the result is Ok, otherwise returns the specified default value v.

v : 'a
result : Result<'a, 'b>
Returns: 'a

defaultWith f result

Full Usage: defaultWith f result

Parameters:
    f : unit -> 'a
    result : Result<'a, 'b>

Returns: 'a
Modifiers: inline

Gets the value of result if the result is Ok, otherwise evaluates f and returns the result.

f : unit -> 'a
result : Result<'a, 'b>
Returns: 'a

either f h result

Full Usage: either f h result

Parameters:
    f : 'a -> 'c
    h : 'b -> 'c
    result : Result<'a, 'b>

Returns: 'c
Modifiers: inline
Type parameters: 'a, 'c, 'b

Case analysis for the Result type. If the value is Ok x, apply the first function to x; if it is Error e, apply the second function to e.

f : 'a -> 'c
h : 'b -> 'c
result : Result<'a, 'b>
Returns: 'c

get x

Full Usage: get x

Parameters:
Returns: 'c
Modifiers: inline
Type parameters: 'c, 'd

If Result is Ok, return its value. Otherwise throw ArgumentException.

x : Result<'c, 'd>
Returns: 'c

lift2 f a b

Full Usage: lift2 f a b

Parameters:
Returns: Result<'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 : Result<'e, 'h>
b : Result<'f, 'h>
Returns: Result<'g, 'h>

ofOption o _arg1

Full Usage: ofOption o _arg1

Parameters:
    o : 'a
    _arg1 : 'b option

Returns: Result<'b, 'a>
Modifiers: inline

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

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

ofOptionF f _arg1

Full Usage: ofOptionF f _arg1

Parameters:
    f : unit -> 'a
    _arg1 : 'b option

Returns: Result<'b, 'a>
Modifiers: inline

If Some value, returns Ok value. Otherwise, returns the supplied default value from a function.

f : unit -> 'a
_arg1 : 'b option
Returns: Result<'b, 'a>

protect f x

Full Usage: protect f x

Parameters:
    f : 'a -> 'b
    x : 'a

Returns: Result<'b, exn>
Modifiers: inline

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

f : 'a -> 'b
x : 'a
Returns: Result<'b, exn>

result

Full Usage: result

Returns: ResultBuilder
Returns: ResultBuilder

returnM x

Full Usage: returnM x

Parameters:
    x : 'a

Returns: Result<'a, 'b>
Modifiers: inline

Inject a value into the Result type

x : 'a
Returns: Result<'a, 'b>

sequence s

Full Usage: sequence s

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