Header menu logo TDesu.FSharp

Option Module

Functions and values

Function or value Description

Option.isTrue v

Full Usage: Option.isTrue v

Parameters:
    v : bool option

Returns: bool
Modifiers: inline

Returns true if the option contains true; false otherwise. The boolean option to check.

v : bool option
Returns: bool

Option.iterIgnore f value

Full Usage: Option.iterIgnore f value

Parameters:
    f : 'T -> 'TResult
    value : 'T option

Modifiers: inline
Type parameters: 'T, 'TResult

Applies an action to the Some value (discarding its return value), or does nothing for None. The function to apply to the contained value. The option to act on.

f : 'T -> 'TResult
value : 'T option

Option.map2 f o1 o2

Full Usage: Option.map2 f o1 o2

Parameters:
    f : 'T1 -> 'T2 -> 'TResult
    o1 : 'T1 option
    o2 : 'T2 option

Returns: 'TResult option
Modifiers: inline
Type parameters: 'T1, 'T2, 'TResult

Maps a function over two option values. None if either is None. The mapping function. The first option. The second option.

f : 'T1 -> 'T2 -> 'TResult
o1 : 'T1 option
o2 : 'T2 option
Returns: 'TResult option

Option.map3 f o1 o2 o3

Full Usage: Option.map3 f o1 o2 o3

Parameters:
    f : 'T1 -> 'T2 -> 'T3 -> 'TResult
    o1 : 'T1 option
    o2 : 'T2 option
    o3 : 'T3 option

Returns: 'TResult option
Modifiers: inline
Type parameters: 'T1, 'T2, 'T3, 'TResult

Maps a function over three option values. None if any is None. The mapping function. The first option. The second option. The third option.

f : 'T1 -> 'T2 -> 'T3 -> 'TResult
o1 : 'T1 option
o2 : 'T2 option
o3 : 'T3 option
Returns: 'TResult option

Option.ofBool v

Full Usage: Option.ofBool v

Parameters:
    v : bool

Returns: unit option
Modifiers: inline

Returns Some(()) if true, None if false. The boolean value to convert.

v : bool
Returns: unit option

Option.ofCSharpTryPattern (status, value)

Full Usage: Option.ofCSharpTryPattern (status, value)

Parameters:
    status : bool
    value : 'a

Returns: 'a option
Modifiers: inline
Type parameters: 'a

Converts a C# TryXxx (bool * value) tuple to an . The success flag from the TryXxx method. The output value from the TryXxx method.

status : bool
value : 'a
Returns: 'a option

Option.ofString s

Full Usage: Option.ofString s

Parameters:
    s : string - The string to convert.

Returns: string option
Modifiers: inline

Returns None if the string is null/empty/whitespace, otherwise Some(s).

s : string

The string to convert.

Returns: string option

Option.someUnit

Full Usage: Option.someUnit

Returns: unit option

Cached Some(()) to avoid allocations.

Returns: unit option

Option.tee f opt

Full Usage: Option.tee f opt

Parameters:
    f : 'T -> unit - The side-effect function to apply.
    opt : 'T option - The option to inspect.

Returns: 'T option
Modifiers: inline
Type parameters: 'T

Applies a side-effect on Some and returns the option unchanged.

f : 'T -> unit

The side-effect function to apply.

opt : 'T option

The option to inspect.

Returns: 'T option

Option.toResult error opt

Full Usage: Option.toResult error opt

Parameters:
    error : 'a - The error value to use when the option is None.
    opt : 'b option - The option to convert.

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

Converts Some to Ok, None to Error with the given error value.

error : 'a

The error value to use when the option is None.

opt : 'b option

The option to convert.

Returns: Result<'b, 'a>

Option.zip o1 o2

Full Usage: Option.zip o1 o2

Parameters:
    o1 : 'T1 option - The first option.
    o2 : 'T2 option - The second option.

Returns: ('T1 * 'T2) option
Modifiers: inline
Type parameters: 'T1, 'T2

Combines two options into a tuple option. None if either is None.

o1 : 'T1 option

The first option.

o2 : 'T2 option

The second option.

Returns: ('T1 * 'T2) option

Type something to start searching.