Option Module
Functions and values
| Function or value |
Description
|
Full Usage:
Option.isTrue v
Parameters:
bool option
Returns: bool
Modifiers: inline |
Returns true if the option contains true; false otherwise. The boolean option to check.
|
Full Usage:
Option.iterIgnore f _arg1
Parameters:
'T -> 'TResult
_arg1 : '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.
|
Full Usage:
Option.map2 f o1 o2
Parameters:
'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.
|
Full Usage:
Option.map3 f o1 o2 o3
Parameters:
'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.
|
Full Usage:
Option.ofBool v
Parameters:
bool
Returns: unit option
Modifiers: inline |
Returns
|
Full Usage:
Option.ofCSharpTryPattern (status, value)
Parameters:
bool
value : 'a
Returns: 'a option
Modifiers: inline Type parameters: 'a |
Converts a C# TryXxx
|
Full Usage:
Option.ofPredicate predicate value
Parameters:
'T -> bool
-
The predicate to test the value with.
value : 'T
-
The value to conditionally wrap.
Returns: 'T option
Modifiers: inline Type parameters: 'T |
Returns predicate is a function argument: per the null policy a null or throwing predicate is a programmer error, so it is called unguarded and any exception (including on a null delegate) propagates unchanged rather than being swallowed.
Example
module Option
from Microsoft.FSharp.Core
|
Full Usage:
Option.ofString s
Parameters:
string
-
The string to convert.
Returns: string option
Modifiers: inline |
Returns
|
Full Usage:
Option.someUnit
Returns: unit option
|
Cached
|
Full Usage:
Option.tee f opt
Parameters:
'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
|
Full Usage:
Option.toResult error _arg1
Parameters:
'a
-
The error value to use when the option is None.
_arg1 : 'b option
Returns: Result<'b, 'a>
Modifiers: inline Type parameters: 'a, 'b |
Converts
|
Full Usage:
Option.tryCast value
Parameters:
obj
-
The boxed value to type-test.
Returns: 'T option
Modifiers: inline Type parameters: 'T |
Type-guard cast: returns
Example
val boxed: obj
type obj = System.Object
val box: value: 'T -> objnull
module Option
from Microsoft.FSharp.Core
Multiple items
val string: value: 'T -> string -------------------- type string = System.String Multiple items
val int: value: 'T -> int (requires member op_Explicit) -------------------- type int = int32 -------------------- type int<'Measure> = int |
Full Usage:
Option.zip o1 o2
Parameters:
'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.
|
TDesu.FSharp