Header menu logo FSharp.Core

ValueOption Module

Contains operations for working with value options.

Functions and values

Function or value Description

ValueOption.bind binder voption

Full Usage: ValueOption.bind binder voption

Parameters:
    binder : 'T -> 'U voption - A function that takes the value of type T from a value option and transforms it into a value option containing a value of type U.
    voption : 'T voption - The input value option.

Returns: 'U voption An option of the output type of the binder.
Modifiers: inline
Type parameters: 'T, 'U

bind f inp evaluates to match inp with ValueNone -> ValueNone | ValueSome x -> f x

binder : 'T -> 'U voption

A function that takes the value of type T from a value option and transforms it into a value option containing a value of type U.

voption : 'T voption

The input value option.

Returns: 'U voption

An option of the output type of the binder.

Example

 let tryParse input =
     match System.Int32.TryParse (input: string) with
     | true, v -> ValueSome v
     | false, _ -> ValueNone
 ValueNone |> ValueOption.bind tryParse // evaluates to ValueNone
 ValueSome "42" |> ValueOption.bind tryParse // evaluates to ValueSome 42
 ValueSome "Forty-two" |> ValueOption.bind tryParse // evaluates to ValueNone
val tryParse: input: string -> int voption
val input: string
namespace System
[<Struct>] type Int32 = member CompareTo: value: int -> int + 1 overload member Equals: obj: int -> bool + 1 overload member GetHashCode: unit -> int member GetTypeCode: unit -> TypeCode member ToString: unit -> string + 3 overloads member TryFormat: utf8Destination: Span<byte> * bytesWritten: byref<int> * ?format: ReadOnlySpan<char> * ?provider: IFormatProvider -> bool + 1 overload static member Abs: value: int -> int static member BigMul: left: int * right: int -> int64 static member Clamp: value: int * min: int * max: int -> int static member CopySign: value: int * sign: int -> int ...
<summary>Represents a 32-bit signed integer.</summary>
System.Int32.TryParse(s: string, result: byref<int>) : bool
System.Int32.TryParse(s: System.ReadOnlySpan<char>, result: byref<int>) : bool
System.Int32.TryParse(utf8Text: System.ReadOnlySpan<byte>, result: byref<int>) : bool
System.Int32.TryParse(s: string, provider: System.IFormatProvider, result: byref<int>) : bool
System.Int32.TryParse(s: System.ReadOnlySpan<char>, provider: System.IFormatProvider, result: byref<int>) : bool
System.Int32.TryParse(utf8Text: System.ReadOnlySpan<byte>, provider: System.IFormatProvider, result: byref<int>) : bool
System.Int32.TryParse(s: string, style: System.Globalization.NumberStyles, provider: System.IFormatProvider, result: byref<int>) : bool
System.Int32.TryParse(s: System.ReadOnlySpan<char>, style: System.Globalization.NumberStyles, provider: System.IFormatProvider, result: byref<int>) : bool
System.Int32.TryParse(utf8Text: System.ReadOnlySpan<byte>, style: System.Globalization.NumberStyles, provider: System.IFormatProvider, result: byref<int>) : bool
Multiple items
val string: value: 'T -> string

--------------------
type string = System.String
val v: int
union case ValueOption.ValueSome: 'T -> ValueOption<'T>
union case ValueOption.ValueNone: ValueOption<'T>
Multiple items
module ValueOption from Microsoft.FSharp.Core

--------------------
[<Struct>] type ValueOption<'T> = | ValueNone | ValueSome of 'T static member Some: value: 'T -> 'T voption static member op_Implicit: value: 'T -> 'T voption member IsNone: bool member IsSome: bool member Value: 'T static member None: 'T voption
val bind: binder: ('T -> 'U voption) -> voption: 'T voption -> 'U voption

ValueOption.contains value voption

Full Usage: ValueOption.contains value voption

Parameters:
    value : 'T - The value to test for equality.
    voption : 'T voption - The input value option.

Returns: bool True if the option is ValueSome and contains a value equal to value, otherwise false.
Modifiers: inline
Type parameters: 'T

Evaluates to true if voption is ValueSome and its value is equal to value.

value : 'T

The value to test for equality.

voption : 'T voption

The input value option.

Returns: bool

True if the option is ValueSome and contains a value equal to value, otherwise false.

Example

 (99, ValueNone) ||> ValueOption.contains // evaluates to false
 (99, ValueSome 99) ||> ValueOption.contains // evaluates to true
 (99, ValueSome 100) ||> ValueOption.contains // evaluates to false
union case ValueOption.ValueNone: ValueOption<'T>
Multiple items
module ValueOption from Microsoft.FSharp.Core

--------------------
[<Struct>] type ValueOption<'T> = | ValueNone | ValueSome of 'T static member Some: value: 'T -> 'T voption static member op_Implicit: value: 'T -> 'T voption member IsNone: bool member IsSome: bool member Value: 'T static member None: 'T voption
val contains: value: 'T -> voption: 'T voption -> bool (requires equality)
union case ValueOption.ValueSome: 'T -> ValueOption<'T>

ValueOption.count voption

Full Usage: ValueOption.count voption

Parameters:
    voption : 'T voption - The input value option.

Returns: int A zero if the option is ValueNone, a one otherwise.
Modifiers: inline
Type parameters: 'T

count inp evaluates to match inp with ValueNone -> 0 | ValueSome _ -> 1.

voption : 'T voption

The input value option.

Returns: int

A zero if the option is ValueNone, a one otherwise.

Example

 ValueNone |> ValueOption.count // evaluates to 0
 ValueSome 99 |> ValueOption.count // evaluates to 1
union case ValueOption.ValueNone: ValueOption<'T>
Multiple items
module ValueOption from Microsoft.FSharp.Core

--------------------
[<Struct>] type ValueOption<'T> = | ValueNone | ValueSome of 'T static member Some: value: 'T -> 'T voption static member op_Implicit: value: 'T -> 'T voption member IsNone: bool member IsSome: bool member Value: 'T static member None: 'T voption
val count: voption: 'T voption -> int
union case ValueOption.ValueSome: 'T -> ValueOption<'T>

ValueOption.defaultValue value voption

Full Usage: ValueOption.defaultValue value voption

Parameters:
    value : 'T - The specified default value.
    voption : 'T voption - The input voption.

Returns: 'T The voption if the voption is ValueSome, else the default value.
Modifiers: inline
Type parameters: 'T

Gets the value of the value option if the option is ValueSome, otherwise returns the specified default value.

Identical to the built-in defaultArg operator, except with the arguments swapped.

value : 'T

The specified default value.

voption : 'T voption

The input voption.

Returns: 'T

The voption if the voption is ValueSome, else the default value.

Example

 (99, ValueNone) ||> ValueOption.defaultValue // evaluates to 99
 (99, ValueSome 42) ||> ValueOption.defaultValue // evaluates to 42
union case ValueOption.ValueNone: ValueOption<'T>
Multiple items
module ValueOption from Microsoft.FSharp.Core

--------------------
[<Struct>] type ValueOption<'T> = | ValueNone | ValueSome of 'T static member Some: value: 'T -> 'T voption static member op_Implicit: value: 'T -> 'T voption member IsNone: bool member IsSome: bool member Value: 'T static member None: 'T voption
val defaultValue: value: 'T -> voption: 'T voption -> 'T
union case ValueOption.ValueSome: 'T -> ValueOption<'T>

ValueOption.defaultWith defThunk voption

Full Usage: ValueOption.defaultWith defThunk voption

Parameters:
    defThunk : unit -> 'T - A thunk that provides a default value when evaluated.
    voption : 'T voption - The input voption.

Returns: 'T The voption if the voption is ValueSome, else the result of evaluating defThunk.
Modifiers: inline
Type parameters: 'T

Gets the value of the voption if the voption is ValueSome, otherwise evaluates defThunk and returns the result.

defThunk is not evaluated unless voption is ValueNone.

defThunk : unit -> 'T

A thunk that provides a default value when evaluated.

voption : 'T voption

The input voption.

Returns: 'T

The voption if the voption is ValueSome, else the result of evaluating defThunk.

Example

 ValueNone |> ValueOption.defaultWith (fun () -> 99) // evaluates to 99
 ValueSome 42 |> ValueOption.defaultWith (fun () -> 99) // evaluates to 42
union case ValueOption.ValueNone: ValueOption<'T>
Multiple items
module ValueOption from Microsoft.FSharp.Core

--------------------
[<Struct>] type ValueOption<'T> = | ValueNone | ValueSome of 'T static member Some: value: 'T -> 'T voption static member op_Implicit: value: 'T -> 'T voption member IsNone: bool member IsSome: bool member Value: 'T static member None: 'T voption
val defaultWith: defThunk: (unit -> 'T) -> voption: 'T voption -> 'T
union case ValueOption.ValueSome: 'T -> ValueOption<'T>

ValueOption.exists predicate voption

Full Usage: ValueOption.exists predicate voption

Parameters:
    predicate : 'T -> bool - A function that evaluates to a boolean when given a value from the option type.
    voption : 'T voption - The input value option.

Returns: bool False if the option is ValueNone, otherwise it returns the result of applying the predicate to the option value.
Modifiers: inline
Type parameters: 'T

exists p inp evaluates to match inp with ValueNone -> false | ValueSome x -> p x.

predicate : 'T -> bool

A function that evaluates to a boolean when given a value from the option type.

voption : 'T voption

The input value option.

Returns: bool

False if the option is ValueNone, otherwise it returns the result of applying the predicate to the option value.

Example

 ValueNone |> ValueOption.exists (fun x -> x >= 5) // evaluates to false
 ValueSome 42 |> ValueOption.exists (fun x -> x >= 5) // evaluates to true
 ValueSome 4 |> ValueOption.exists (fun x -> x >= 5) // evaluates to false
union case ValueOption.ValueNone: ValueOption<'T>
Multiple items
module ValueOption from Microsoft.FSharp.Core

--------------------
[<Struct>] type ValueOption<'T> = | ValueNone | ValueSome of 'T static member Some: value: 'T -> 'T voption static member op_Implicit: value: 'T -> 'T voption member IsNone: bool member IsSome: bool member Value: 'T static member None: 'T voption
val exists: predicate: ('T -> bool) -> voption: 'T voption -> bool
val x: int
union case ValueOption.ValueSome: 'T -> ValueOption<'T>

ValueOption.filter predicate voption

Full Usage: ValueOption.filter predicate voption

Parameters:
    predicate : 'T -> bool - A function that evaluates whether the value contained in the value option should remain, or be filtered out.
    voption : 'T voption - The input value option.

Returns: 'T voption The input if the predicate evaluates to true; otherwise, ValueNone.
Modifiers: inline
Type parameters: 'T

filter f inp evaluates to match inp with ValueNone -> ValueNone | ValueSome x -> if f x then ValueSome x else ValueNone.

predicate : 'T -> bool

A function that evaluates whether the value contained in the value option should remain, or be filtered out.

voption : 'T voption

The input value option.

Returns: 'T voption

The input if the predicate evaluates to true; otherwise, ValueNone.

Example

 ValueNone |> ValueOption.filter (fun x -> x >= 5) // evaluates to ValueNone
 ValueSome 42 |> ValueOption.filter (fun x -> x >= 5) // evaluates to ValueSome 42
 ValueSome 4 |> ValueOption.filter (fun x -> x >= 5) // evaluates to ValueNone
union case ValueOption.ValueNone: ValueOption<'T>
Multiple items
module ValueOption from Microsoft.FSharp.Core

--------------------
[<Struct>] type ValueOption<'T> = | ValueNone | ValueSome of 'T static member Some: value: 'T -> 'T voption static member op_Implicit: value: 'T -> 'T voption member IsNone: bool member IsSome: bool member Value: 'T static member None: 'T voption
val filter: predicate: ('T -> bool) -> voption: 'T voption -> 'T voption
val x: int
union case ValueOption.ValueSome: 'T -> ValueOption<'T>

ValueOption.flatten voption

Full Usage: ValueOption.flatten voption

Parameters:
Returns: 'T voption The input value if the value is Some; otherwise, ValueNone.
Modifiers: inline
Type parameters: 'T

flatten inp evaluates to match inp with ValueNone -> ValueNone | ValueSome x -> x

flatten is equivalent to bind id.

voption : 'T voption voption

The input value option.

Returns: 'T voption

The input value if the value is Some; otherwise, ValueNone.

Example

 (ValueNone: int ValueOption ValueOption) |> ValueOption.flatten // evaluates to ValueNone
 (ValueSome ((ValueNone: int ValueOption))) |> ValueOption.flatten // evaluates to ValueNone
 (ValueSome (ValueSome 42)) |> ValueOption.flatten // evaluates to ValueSome 42
union case ValueOption.ValueNone: ValueOption<'T>
Multiple items
val int: value: 'T -> int (requires member op_Explicit)

--------------------
type int = int32

--------------------
type int<'Measure> = int
Multiple items
module ValueOption from Microsoft.FSharp.Core

--------------------
[<Struct>] type ValueOption<'T> = | ValueNone | ValueSome of 'T static member Some: value: 'T -> 'T voption static member op_Implicit: value: 'T -> 'T voption member IsNone: bool member IsSome: bool member Value: 'T static member None: 'T voption
val flatten: voption: 'T voption voption -> 'T voption
union case ValueOption.ValueSome: 'T -> ValueOption<'T>

ValueOption.fold folder state voption

Full Usage: ValueOption.fold folder state voption

Parameters:
    folder : 'State -> 'T -> 'State - A function to update the state data when given a value from a value option.
    state : 'State - The initial state.
    voption : 'T voption - The input value option.

Returns: 'State The original state if the option is ValueNone, otherwise it returns the updated state with the folder and the voption value.
Modifiers: inline
Type parameters: 'T, 'State

fold f s inp evaluates to match inp with ValueNone -> s | ValueSome x -> f s x.

folder : 'State -> 'T -> 'State

A function to update the state data when given a value from a value option.

state : 'State

The initial state.

voption : 'T voption

The input value option.

Returns: 'State

The original state if the option is ValueNone, otherwise it returns the updated state with the folder and the voption value.

Example

 (0, ValueNone) ||> ValueOption.fold (fun accum x -> accum + x * 2) // evaluates to 0
 (0, ValueSome 1) ||> ValueOption.fold (fun accum x -> accum + x * 2) // evaluates to 2
 (10, ValueSome 1) ||> ValueOption.fold (fun accum x -> accum + x * 2) // evaluates to 12
union case ValueOption.ValueNone: ValueOption<'T>
Multiple items
module ValueOption from Microsoft.FSharp.Core

--------------------
[<Struct>] type ValueOption<'T> = | ValueNone | ValueSome of 'T static member Some: value: 'T -> 'T voption static member op_Implicit: value: 'T -> 'T voption member IsNone: bool member IsSome: bool member Value: 'T static member None: 'T voption
val fold<'T,'State> : folder: ('State -> 'T -> 'State) -> state: 'State -> voption: 'T voption -> 'State
val accum: int
val x: int
union case ValueOption.ValueSome: 'T -> ValueOption<'T>

ValueOption.foldBack folder voption state

Full Usage: ValueOption.foldBack folder voption state

Parameters:
    folder : 'T -> 'State -> 'State - A function to update the state data when given a value from a value option.
    voption : 'T voption - The input value option.
    state : 'State - The initial state.

Returns: 'State The original state if the option is ValueNone, otherwise it returns the updated state with the folder and the voption value.
Modifiers: inline
Type parameters: 'T, 'State

fold f inp s evaluates to match inp with ValueNone -> s | ValueSome x -> f x s.

folder : 'T -> 'State -> 'State

A function to update the state data when given a value from a value option.

voption : 'T voption

The input value option.

state : 'State

The initial state.

Returns: 'State

The original state if the option is ValueNone, otherwise it returns the updated state with the folder and the voption value.

Example

 (ValueNone, 0) ||> ValueOption.foldBack (fun x accum -> accum + x * 2) // evaluates to 0
 (ValueSome 1, 0) ||> ValueOption.foldBack (fun x accum -> accum + x * 2) // evaluates to 2
 (ValueSome 1, 10) ||> ValueOption.foldBack (fun x accum -> accum + x * 2) // evaluates to 12
union case ValueOption.ValueNone: ValueOption<'T>
Multiple items
module ValueOption from Microsoft.FSharp.Core

--------------------
[<Struct>] type ValueOption<'T> = | ValueNone | ValueSome of 'T static member Some: value: 'T -> 'T voption static member op_Implicit: value: 'T -> 'T voption member IsNone: bool member IsSome: bool member Value: 'T static member None: 'T voption
val foldBack: folder: ('T -> 'State -> 'State) -> voption: 'T voption -> state: 'State -> 'State
val x: int
val accum: int
union case ValueOption.ValueSome: 'T -> ValueOption<'T>

ValueOption.forall predicate voption

Full Usage: ValueOption.forall predicate voption

Parameters:
    predicate : 'T -> bool - A function that evaluates to a boolean when given a value from the value option type.
    voption : 'T voption - The input value option.

Returns: bool True if the option is None, otherwise it returns the result of applying the predicate to the option value.
Modifiers: inline
Type parameters: 'T

forall p inp evaluates to match inp with ValueNone -> true | ValueSome x -> p x.

predicate : 'T -> bool

A function that evaluates to a boolean when given a value from the value option type.

voption : 'T voption

The input value option.

Returns: bool

True if the option is None, otherwise it returns the result of applying the predicate to the option value.

Example

 ValueNone |> ValueOption.forall (fun x -> x >= 5) // evaluates to true
 ValueSome 42 |> ValueOption.forall (fun x -> x >= 5) // evaluates to true
 ValueSome 4 |> ValueOption.forall (fun x -> x >= 5) // evaluates to false
union case ValueOption.ValueNone: ValueOption<'T>
Multiple items
module ValueOption from Microsoft.FSharp.Core

--------------------
[<Struct>] type ValueOption<'T> = | ValueNone | ValueSome of 'T static member Some: value: 'T -> 'T voption static member op_Implicit: value: 'T -> 'T voption member IsNone: bool member IsSome: bool member Value: 'T static member None: 'T voption
val forall: predicate: ('T -> bool) -> voption: 'T voption -> bool
val x: int
union case ValueOption.ValueSome: 'T -> ValueOption<'T>

ValueOption.get voption

Full Usage: ValueOption.get voption

Parameters:
    voption : 'T voption - The input value option.

Returns: 'T The value within the option.

Gets the value associated with the option.

voption : 'T voption

The input value option.

Returns: 'T

The value within the option.

Example

 ValueSome 42 |> ValueOption.get // evaluates to 42
 (ValueNone: int ValueOption) |> ValueOption.get // throws exception!
union case ValueOption.ValueSome: 'T -> ValueOption<'T>
Multiple items
module ValueOption from Microsoft.FSharp.Core

--------------------
[<Struct>] type ValueOption<'T> = | ValueNone | ValueSome of 'T static member Some: value: 'T -> 'T voption static member op_Implicit: value: 'T -> 'T voption member IsNone: bool member IsSome: bool member Value: 'T static member None: 'T voption
val get: voption: 'T voption -> 'T
union case ValueOption.ValueNone: ValueOption<'T>
Multiple items
val int: value: 'T -> int (requires member op_Explicit)

--------------------
type int = int32

--------------------
type int<'Measure> = int

ValueOption.isNone voption

Full Usage: ValueOption.isNone voption

Parameters:
    voption : 'T voption - The input value option.

Returns: bool True if the voption is ValueNone.
Modifiers: inline
Type parameters: 'T

Returns true if the value option is ValueNone.

voption : 'T voption

The input value option.

Returns: bool

True if the voption is ValueNone.

Example

 ValueNone |> ValueOption.isNone // evaluates to true
 ValueSome 42 |> ValueOption.isNone // evaluates to false
union case ValueOption.ValueNone: ValueOption<'T>
Multiple items
module ValueOption from Microsoft.FSharp.Core

--------------------
[<Struct>] type ValueOption<'T> = | ValueNone | ValueSome of 'T static member Some: value: 'T -> 'T voption static member op_Implicit: value: 'T -> 'T voption member IsNone: bool member IsSome: bool member Value: 'T static member None: 'T voption
val isNone: voption: 'T voption -> bool
union case ValueOption.ValueSome: 'T -> ValueOption<'T>

ValueOption.isSome voption

Full Usage: ValueOption.isSome voption

Parameters:
    voption : 'T voption - The input value option.

Returns: bool True if the value option is not ValueNone.
Modifiers: inline
Type parameters: 'T

Returns true if the value option is not ValueNone.

voption : 'T voption

The input value option.

Returns: bool

True if the value option is not ValueNone.

Example

 ValueNone |> ValueOption.isSome // evaluates to false
 ValueSome 42 |> ValueOption.isSome // evaluates to true
union case ValueOption.ValueNone: ValueOption<'T>
Multiple items
module ValueOption from Microsoft.FSharp.Core

--------------------
[<Struct>] type ValueOption<'T> = | ValueNone | ValueSome of 'T static member Some: value: 'T -> 'T voption static member op_Implicit: value: 'T -> 'T voption member IsNone: bool member IsSome: bool member Value: 'T static member None: 'T voption
val isSome: voption: 'T voption -> bool
union case ValueOption.ValueSome: 'T -> ValueOption<'T>

ValueOption.iter action voption

Full Usage: ValueOption.iter action voption

Parameters:
    action : 'T -> unit - A function to apply to the voption value.
    voption : 'T voption - The input value option.

Modifiers: inline
Type parameters: 'T

iter f inp executes match inp with ValueNone -> () | ValueSome x -> f x.

action : 'T -> unit

A function to apply to the voption value.

voption : 'T voption

The input value option.

Example

 ValueNone |> ValueOption.iter (printfn "%s") // does nothing
 ValueSome "Hello world" |> ValueOption.iter (printfn "%s") // prints "Hello world"
union case ValueOption.ValueNone: ValueOption<'T>
Multiple items
module ValueOption from Microsoft.FSharp.Core

--------------------
[<Struct>] type ValueOption<'T> = | ValueNone | ValueSome of 'T static member Some: value: 'T -> 'T voption static member op_Implicit: value: 'T -> 'T voption member IsNone: bool member IsSome: bool member Value: 'T static member None: 'T voption
val iter: action: ('T -> unit) -> voption: 'T voption -> unit
val printfn: format: Printf.TextWriterFormat<'T> -> 'T
union case ValueOption.ValueSome: 'T -> ValueOption<'T>

ValueOption.map mapping voption

Full Usage: ValueOption.map mapping voption

Parameters:
    mapping : 'T -> 'U - A function to apply to the voption value.
    voption : 'T voption - The input value option.

Returns: 'U voption A value option of the input value after applying the mapping function, or ValueNone if the input is ValueNone.
Modifiers: inline
Type parameters: 'T, 'U

map f inp evaluates to match inp with ValueNone -> ValueNone | ValueSome x -> ValueSome (f x).

mapping : 'T -> 'U

A function to apply to the voption value.

voption : 'T voption

The input value option.

Returns: 'U voption

A value option of the input value after applying the mapping function, or ValueNone if the input is ValueNone.

Example

 ValueNone |> ValueOption.map (fun x -> x * 2) // evaluates to ValueNone
 ValueSome 42 |> ValueOption.map (fun x -> x * 2) // evaluates to ValueSome 84
union case ValueOption.ValueNone: ValueOption<'T>
Multiple items
module ValueOption from Microsoft.FSharp.Core

--------------------
[<Struct>] type ValueOption<'T> = | ValueNone | ValueSome of 'T static member Some: value: 'T -> 'T voption static member op_Implicit: value: 'T -> 'T voption member IsNone: bool member IsSome: bool member Value: 'T static member None: 'T voption
val map: mapping: ('T -> 'U) -> voption: 'T voption -> 'U voption
val x: int
union case ValueOption.ValueSome: 'T -> ValueOption<'T>

ValueOption.map2 mapping voption1 voption2

Full Usage: ValueOption.map2 mapping voption1 voption2

Parameters:
    mapping : 'T1 -> 'T2 -> 'U - A function to apply to the voption values.
    voption1 : 'T1 voption - The first value option.
    voption2 : 'T2 voption - The second value option.

Returns: 'U voption A value option of the input values after applying the mapping function, or ValueNone if either input is ValueNone.
Modifiers: inline
Type parameters: 'T1, 'T2, 'U

map f voption1 voption2 evaluates to match voption1, voption2 with ValueSome x, ValueSome y -> ValueSome (f x y) | _ -> ValueNone.

mapping : 'T1 -> 'T2 -> 'U

A function to apply to the voption values.

voption1 : 'T1 voption

The first value option.

voption2 : 'T2 voption

The second value option.

Returns: 'U voption

A value option of the input values after applying the mapping function, or ValueNone if either input is ValueNone.

Example

 (ValueNone, ValueNone) ||> ValueOption.map2 (fun x y -> x + y) // evaluates to ValueNone
 (ValueSome 5, ValueNone) ||> ValueOption.map2 (fun x y -> x + y) // evaluates to ValueNone
 (ValueNone, ValueSome 10) ||> ValueOption.map2 (fun x y -> x + y) // evaluates to ValueNone
 (ValueSome 5, ValueSome 10) ||> ValueOption.map2 (fun x y -> x + y) // evaluates to ValueSome 15
union case ValueOption.ValueNone: ValueOption<'T>
Multiple items
module ValueOption from Microsoft.FSharp.Core

--------------------
[<Struct>] type ValueOption<'T> = | ValueNone | ValueSome of 'T static member Some: value: 'T -> 'T voption static member op_Implicit: value: 'T -> 'T voption member IsNone: bool member IsSome: bool member Value: 'T static member None: 'T voption
val map2: mapping: ('T1 -> 'T2 -> 'U) -> voption1: 'T1 voption -> voption2: 'T2 voption -> 'U voption
val x: int
val y: int
union case ValueOption.ValueSome: 'T -> ValueOption<'T>

ValueOption.map3 mapping voption1 voption2 voption3

Full Usage: ValueOption.map3 mapping voption1 voption2 voption3

Parameters:
    mapping : 'T1 -> 'T2 -> 'T3 -> 'U - A function to apply to the value option values.
    voption1 : 'T1 voption - The first value option.
    voption2 : 'T2 voption - The second value option.
    voption3 : 'T3 voption - The third value option.

Returns: 'U voption A value option of the input values after applying the mapping function, or ValueNone if any input is ValueNone.
Modifiers: inline
Type parameters: 'T1, 'T2, 'T3, 'U

map f voption1 voption2 voption3 evaluates to match voption1, voption2, voption3 with ValueSome x, ValueSome y, ValueSome z -> ValueSome (f x y z) | _ -> ValueNone.

mapping : 'T1 -> 'T2 -> 'T3 -> 'U

A function to apply to the value option values.

voption1 : 'T1 voption

The first value option.

voption2 : 'T2 voption

The second value option.

voption3 : 'T3 voption

The third value option.

Returns: 'U voption

A value option of the input values after applying the mapping function, or ValueNone if any input is ValueNone.

Example

 (ValueNone, ValueNone, ValueNone) |||> ValueOption.map3 (fun x y z -> x + y + z) // evaluates to ValueNone
 (ValueSome 100, ValueNone, ValueNone) |||> ValueOption.map3 (fun x y z -> x + y + z) // evaluates to ValueNone
 (ValueNone, ValueSome 100, ValueNone) |||> ValueOption.map3 (fun x y z -> x + y + z) // evaluates to ValueNone
 (ValueNone, ValueNone, ValueSome 100) |||> ValueOption.map3 (fun x y z -> x + y + z) // evaluates to ValueNone
 (ValueSome 5, ValueSome 100, ValueSome 10) |||> ValueOption.map3 (fun x y z -> x + y + z) // evaluates to ValueSome 115
union case ValueOption.ValueNone: ValueOption<'T>
Multiple items
module ValueOption from Microsoft.FSharp.Core

--------------------
[<Struct>] type ValueOption<'T> = | ValueNone | ValueSome of 'T static member Some: value: 'T -> 'T voption static member op_Implicit: value: 'T -> 'T voption member IsNone: bool member IsSome: bool member Value: 'T static member None: 'T voption
val map3: mapping: ('T1 -> 'T2 -> 'T3 -> 'U) -> voption1: 'T1 voption -> voption2: 'T2 voption -> voption3: 'T3 voption -> 'U voption
val x: int
val y: int
val z: int
union case ValueOption.ValueSome: 'T -> ValueOption<'T>

ValueOption.ofNullable value

Full Usage: ValueOption.ofNullable value

Parameters:
    value : Nullable<'T> - The input nullable value.

Returns: 'T voption The result value option.
Modifiers: inline
Type parameters: 'T

Convert a Nullable value to a value option.

value : Nullable<'T>

The input nullable value.

Returns: 'T voption

The result value option.

Example

 System.Nullable<int>() |> ValueOption.ofNullable // evaluates to ValueNone
 System.Nullable(42) |> ValueOption.ofNullable // evaluates to ValueSome 42
namespace System
Multiple items
[<Struct>] type Nullable<'T (requires default constructor and value type and 'T :> ValueType)> = new: value: 'T -> unit member Equals: other: obj -> bool member GetHashCode: unit -> int member GetValueOrDefault: unit -> 'T + 1 overload member ToString: unit -> string static member op_Explicit: value: Nullable<'T> -> 'T static member op_Implicit: value: 'T -> Nullable<'T> member HasValue: bool member Value: 'T
<summary>Represents a value type that can be assigned <see langword="null" />.</summary>
<typeparam name="T">The underlying value type of the <see cref="T:System.Nullable`1" /> generic type.</typeparam>


--------------------
type Nullable = static member Compare<'T (requires default constructor and value type and 'T :> ValueType)> : n1: Nullable<'T> * n2: Nullable<'T> -> int static member Equals<'T (requires default constructor and value type and 'T :> ValueType)> : n1: Nullable<'T> * n2: Nullable<'T> -> bool static member GetUnderlyingType: nullableType: Type -> Type static member GetValueRefOrDefaultRef<'T (requires default constructor and value type and 'T :> ValueType)> : nullable: byref<Nullable<'T>> -> inref<'T>
<summary>Supports a value type that can be assigned <see langword="null" />. This class cannot be inherited.</summary>

--------------------
System.Nullable ()
System.Nullable(value: 'T) : System.Nullable<'T>
Multiple items
val int: value: 'T -> int (requires member op_Explicit)

--------------------
type int = int32

--------------------
type int<'Measure> = int
Multiple items
module ValueOption from Microsoft.FSharp.Core

--------------------
[<Struct>] type ValueOption<'T> = | ValueNone | ValueSome of 'T static member Some: value: 'T -> 'T voption static member op_Implicit: value: 'T -> 'T voption member IsNone: bool member IsSome: bool member Value: 'T static member None: 'T voption
val ofNullable: value: System.Nullable<'T> -> 'T voption (requires default constructor and value type and 'T :> System.ValueType)

ValueOption.ofObj value

Full Usage: ValueOption.ofObj value

Parameters:
    value : 'T - The input value.

Returns: 'T voption The result value option.
Modifiers: inline
Type parameters: 'T

Convert a potentially null value to a value option.

value : 'T

The input value.

Returns: 'T voption

The result value option.

Example

 (null: string) |> ValueOption.ofObj // evaluates to ValueNone
 "not a null string" |> ValueOption.ofObj // evaluates to (ValueSome "not a null string")
Multiple items
val string: value: 'T -> string

--------------------
type string = System.String
Multiple items
module ValueOption from Microsoft.FSharp.Core

--------------------
[<Struct>] type ValueOption<'T> = | ValueNone | ValueSome of 'T static member Some: value: 'T -> 'T voption static member op_Implicit: value: 'T -> 'T voption member IsNone: bool member IsSome: bool member Value: 'T static member None: 'T voption
val ofObj: value: 'T -> 'T voption (requires 'T: null)

ValueOption.ofOption option

Full Usage: ValueOption.ofOption option

Parameters:
    option : 'T option - The input option.

Returns: 'T voption The resulting value option.
Modifiers: inline
Type parameters: 'T

Convert an option to a value option.

option : 'T option

The input option.

Returns: 'T voption

The resulting value option.

Example

 Some 42 |> ValueOption.ofOption // evaluates to ValueSome 42
 (None: int option) |> ValueOption.ofOption // evaluates to ValueNone
union case Option.Some: Value: 'T -> Option<'T>
Multiple items
module ValueOption from Microsoft.FSharp.Core

--------------------
[<Struct>] type ValueOption<'T> = | ValueNone | ValueSome of 'T static member Some: value: 'T -> 'T voption static member op_Implicit: value: 'T -> 'T voption member IsNone: bool member IsSome: bool member Value: 'T static member None: 'T voption
union case Option.None: Option<'T>
Multiple items
val int: value: 'T -> int (requires member op_Explicit)

--------------------
type int = int32

--------------------
type int<'Measure> = int
type 'T option = Option<'T>

ValueOption.orElse ifNone voption

Full Usage: ValueOption.orElse ifNone voption

Parameters:
    ifNone : 'T voption - The value to use if voption is None.
    voption : 'T voption - The input option.

Returns: 'T voption The option if the option is Some, else the alternate option.
Modifiers: inline
Type parameters: 'T

Returns voption if it is Some, otherwise returns ifNone.

ifNone : 'T voption

The value to use if voption is None.

voption : 'T voption

The input option.

Returns: 'T voption

The option if the option is Some, else the alternate option.

Example

 ((ValueNone: int ValueOption), ValueNone) ||> ValueOption.orElse // evaluates to ValueNone
 (ValueSome 99, ValueNone) ||> ValueOption.orElse // evaluates to ValueSome 99
 (ValueNone, ValueSome 42) ||> ValueOption.orElse // evaluates to ValueSome 42
 (ValueSome 99, ValueSome 42) ||> ValueOption.orElse // evaluates to ValueSome 42
union case ValueOption.ValueNone: ValueOption<'T>
Multiple items
val int: value: 'T -> int (requires member op_Explicit)

--------------------
type int = int32

--------------------
type int<'Measure> = int
Multiple items
module ValueOption from Microsoft.FSharp.Core

--------------------
[<Struct>] type ValueOption<'T> = | ValueNone | ValueSome of 'T static member Some: value: 'T -> 'T voption static member op_Implicit: value: 'T -> 'T voption member IsNone: bool member IsSome: bool member Value: 'T static member None: 'T voption
val orElse: ifNone: 'T voption -> voption: 'T voption -> 'T voption
union case ValueOption.ValueSome: 'T -> ValueOption<'T>

ValueOption.orElseWith ifNoneThunk voption

Full Usage: ValueOption.orElseWith ifNoneThunk voption

Parameters:
    ifNoneThunk : unit -> 'T voption - A thunk that provides an alternate value option when evaluated.
    voption : 'T voption - The input value option.

Returns: 'T voption The voption if the voption is ValueSome, else the result of evaluating ifNoneThunk.
Modifiers: inline
Type parameters: 'T

Returns voption if it is Some, otherwise evaluates ifNoneThunk and returns the result.

ifNoneThunk is not evaluated unless voption is ValueNone.

ifNoneThunk : unit -> 'T voption

A thunk that provides an alternate value option when evaluated.

voption : 'T voption

The input value option.

Returns: 'T voption

The voption if the voption is ValueSome, else the result of evaluating ifNoneThunk.

Example

 (ValueNone: int ValueOption) |> ValueOption.orElseWith (fun () -> ValueNone) // evaluates to ValueNone
 ValueNone |> ValueOption.orElseWith (fun () -> (ValueSome 99)) // evaluates to ValueSome 99
 ValueSome 42 |> ValueOption.orElseWith (fun () -> ValueNone) // evaluates to ValueSome 42
 ValueSome 42 |> ValueOption.orElseWith (fun () -> (ValueSome 99)) // evaluates to ValueSome 42
union case ValueOption.ValueNone: ValueOption<'T>
Multiple items
val int: value: 'T -> int (requires member op_Explicit)

--------------------
type int = int32

--------------------
type int<'Measure> = int
Multiple items
module ValueOption from Microsoft.FSharp.Core

--------------------
[<Struct>] type ValueOption<'T> = | ValueNone | ValueSome of 'T static member Some: value: 'T -> 'T voption static member op_Implicit: value: 'T -> 'T voption member IsNone: bool member IsSome: bool member Value: 'T static member None: 'T voption
val orElseWith: ifNoneThunk: (unit -> 'T voption) -> voption: 'T voption -> 'T voption
union case ValueOption.ValueSome: 'T -> ValueOption<'T>

ValueOption.toArray voption

Full Usage: ValueOption.toArray voption

Parameters:
    voption : 'T voption - The input value option.

Returns: 'T array The result array.
Modifiers: inline
Type parameters: 'T

Convert the value option to an array of length 0 or 1.

voption : 'T voption

The input value option.

Returns: 'T array

The result array.

Example

 (ValueNone: int ValueOption) |> ValueOption.toArray // evaluates to [||]
 ValueSome 42 |> ValueOption.toArray // evaluates to [|42|]
union case ValueOption.ValueNone: ValueOption<'T>
Multiple items
val int: value: 'T -> int (requires member op_Explicit)

--------------------
type int = int32

--------------------
type int<'Measure> = int
Multiple items
module ValueOption from Microsoft.FSharp.Core

--------------------
[<Struct>] type ValueOption<'T> = | ValueNone | ValueSome of 'T static member Some: value: 'T -> 'T voption static member op_Implicit: value: 'T -> 'T voption member IsNone: bool member IsSome: bool member Value: 'T static member None: 'T voption
val toArray: voption: 'T voption -> 'T array
union case ValueOption.ValueSome: 'T -> ValueOption<'T>

ValueOption.toList voption

Full Usage: ValueOption.toList voption

Parameters:
    voption : 'T voption - The input value option.

Returns: 'T list The result list.
Modifiers: inline
Type parameters: 'T

Convert the value option to a list of length 0 or 1.

voption : 'T voption

The input value option.

Returns: 'T list

The result list.

Example

 (ValueNone: int ValueOption) |> ValueOption.toList // evaluates to []
 ValueSome 42 |> ValueOption.toList // evaluates to [42]
union case ValueOption.ValueNone: ValueOption<'T>
Multiple items
val int: value: 'T -> int (requires member op_Explicit)

--------------------
type int = int32

--------------------
type int<'Measure> = int
Multiple items
module ValueOption from Microsoft.FSharp.Core

--------------------
[<Struct>] type ValueOption<'T> = | ValueNone | ValueSome of 'T static member Some: value: 'T -> 'T voption static member op_Implicit: value: 'T -> 'T voption member IsNone: bool member IsSome: bool member Value: 'T static member None: 'T voption
val toList: voption: 'T voption -> 'T list
union case ValueOption.ValueSome: 'T -> ValueOption<'T>

ValueOption.toNullable voption

Full Usage: ValueOption.toNullable voption

Parameters:
    voption : 'T voption - The input value option.

Returns: Nullable<'T> The result value.
Modifiers: inline
Type parameters: 'T

Convert the value option to a Nullable value.

voption : 'T voption

The input value option.

Returns: Nullable<'T>

The result value.

Example

 (ValueNone: int ValueOption) |> ValueOption.toNullable // evaluates to new System.Nullable<int>()
 ValueSome 42 |> ValueOption.toNullable // evaluates to new System.Nullable(42)
union case ValueOption.ValueNone: ValueOption<'T>
Multiple items
val int: value: 'T -> int (requires member op_Explicit)

--------------------
type int = int32

--------------------
type int<'Measure> = int
Multiple items
module ValueOption from Microsoft.FSharp.Core

--------------------
[<Struct>] type ValueOption<'T> = | ValueNone | ValueSome of 'T static member Some: value: 'T -> 'T voption static member op_Implicit: value: 'T -> 'T voption member IsNone: bool member IsSome: bool member Value: 'T static member None: 'T voption
val toNullable: voption: 'T voption -> System.Nullable<'T> (requires default constructor and value type and 'T :> System.ValueType)
union case ValueOption.ValueSome: 'T -> ValueOption<'T>

ValueOption.toObj value

Full Usage: ValueOption.toObj value

Parameters:
    value : 'T voption - The input value.

Returns: 'T The result value, which is null if the input was ValueNone.
Modifiers: inline
Type parameters: 'T

Convert an option to a potentially null value.

value : 'T voption

The input value.

Returns: 'T

The result value, which is null if the input was ValueNone.

Example

 (ValueNone: string ValueOption) |> ValueOption.toObj // evaluates to null
 ValueSome "not a null string" |> ValueOption.toObj // evaluates to "not a null string"
union case ValueOption.ValueNone: ValueOption<'T>
Multiple items
val string: value: 'T -> string

--------------------
type string = System.String
Multiple items
module ValueOption from Microsoft.FSharp.Core

--------------------
[<Struct>] type ValueOption<'T> = | ValueNone | ValueSome of 'T static member Some: value: 'T -> 'T voption static member op_Implicit: value: 'T -> 'T voption member IsNone: bool member IsSome: bool member Value: 'T static member None: 'T voption
val toObj: value: 'T voption -> 'T (requires 'T: null)
union case ValueOption.ValueSome: 'T -> ValueOption<'T>

ValueOption.toOption voption

Full Usage: ValueOption.toOption voption

Parameters:
    voption : 'T voption - The input value option.

Returns: 'T option The resulting option.
Modifiers: inline
Type parameters: 'T

Convert a value option to an option.

voption : 'T voption

The input value option.

Returns: 'T option

The resulting option.

Example

 ValueSome 42 |> ValueOption.toOption // evaluates to Some 42
 (ValueNone: int voption) |> ValueOption.toOption // evaluates to None
union case ValueOption.ValueSome: 'T -> ValueOption<'T>
Multiple items
module ValueOption from Microsoft.FSharp.Core

--------------------
[<Struct>] type ValueOption<'T> = | ValueNone | ValueSome of 'T static member Some: value: 'T -> 'T voption static member op_Implicit: value: 'T -> 'T voption member IsNone: bool member IsSome: bool member Value: 'T static member None: 'T voption
union case ValueOption.ValueNone: ValueOption<'T>
Multiple items
val int: value: 'T -> int (requires member op_Explicit)

--------------------
type int = int32

--------------------
type int<'Measure> = int
type 'T voption = ValueOption<'T>

Type something to start searching.