OptionExtensions Module
Fluent extension operations on options.
Type extensions
Type extension | Description |
Full Usage:
this.bind binder
Parameters:
'T -> 'U option
-
A function that takes the value of type T from an option and transforms it into
an option containing a value of type U.
Returns: 'U option
An option of the output type of the binder.
Modifiers: inline Type parameters: 'U |
Extended Type:
|
Full Usage:
this.count ()
Parameters:
unit
Returns: int
A zero if the option is None, a one otherwise.
Modifiers: inline |
|
Full Usage:
this.count
Returns: int
A zero if the option is None, a one otherwise.
Modifiers: inline |
|
Full Usage:
this.exists predicate
Parameters:
'T -> bool
-
A function that evaluates to a boolean when given a value from the option type.
Returns: bool
False if the option is None, otherwise it returns the result of applying the predicate
to the option value.
Modifiers: inline |
Extended Type:
|
Full Usage:
this.filter predicate
Parameters:
'T -> bool
-
A function that evaluates whether the value contained in the option should remain, or be filtered out.
Returns: 'T option
The input if the predicate evaluates to true; otherwise, None.
Modifiers: inline |
Extended Type:
|
Full Usage:
this.fold (state, folder)
Parameters:
'State
-
The initial state.
folder : 'State -> 'T -> 'State
-
A function to update the state data when given a value from an option.
Returns: 'State
The original state if the option is None, otherwise it returns the updated state with the folder
and the option value.
Modifiers: inline Type parameters: 'State |
Extended Type:
|
Full Usage:
this.foldBack (folder, state)
Parameters:
'T -> 'State -> 'State
-
A function to update the state data when given a value from an option.
state : 'State
-
The initial state.
Returns: 'State
The original state if the option is None, otherwise it returns the updated state with the folder
and the option value.
Modifiers: inline Type parameters: 'State |
Extended Type:
|
Full Usage:
this.forall predicate
Parameters:
'T -> bool
-
A function that evaluates to a boolean when given a value from the option type.
Returns: bool
True if the option is None, otherwise it returns the result of applying the predicate
to the option value.
Modifiers: inline |
Extended Type:
|
Full Usage:
this.iter action
Parameters:
'T -> unit
-
A function to apply to the option value.
Modifiers: inline |
|
Full Usage:
this.map mapping
Parameters:
'T -> 'U
-
A function to apply to the option value.
Returns: 'U option
An option of the input value after applying the mapping function, or None if the input is None.
Modifiers: inline Type parameters: 'U |
Extended Type:
|
Full Usage:
this.toArray ()
Parameters:
unit
Returns: 'T[]
The result array.
Modifiers: inline |
|
Full Usage:
this.toList ()
Parameters:
unit
Returns: 'T list
The result list.
Modifiers: inline |