Deedle


OptionalValue

Namespace: Deedle
Attributes:
[<CompilationRepresentation(4)>]

Provides various helper functions for using the OptionalValue<T> type from F# (The functions are similar to those in the standard Option module).

Functions and values

Function or valueDescription
asOption(value)
Signature: value:'T opt -> 'T option
Type parameters: 'T

Turns the OptionalValue<T> into a corresponding standard F# option<T> value

bind f input
Signature: f:('T -> OptionalValue<'R>) -> input:OptionalValue<'T> -> OptionalValue<'R>
Type parameters: 'T, 'R Attributes:
[<CompiledName("Bind")>]

If the OptionalValue<T> does not contain a value, then returns a new OptionalValue<R>.Empty. Otherwise, returns the result of applying the function f to the value contained in the provided optional value.

CompiledName: Bind

defaultArg def optional
Signature: def:'T -> optional:'T opt -> 'T
Type parameters: 'T

Returns the value def when the argument is missing, otherwise returns its value

get(optional)
Signature: optional:'T opt -> 'T
Type parameters: 'T

Get the value stored in the specified optional value. If a value is not available, throws an exception. (This is equivalent to the Value property)

map f input
Signature: f:('T -> 'R) -> input:OptionalValue<'T> -> OptionalValue<'R>
Type parameters: 'T, 'R Attributes:
[<CompiledName("Map")>]

If the OptionalValue<T> does not contain a value, then returns a new OptionalValue<R>.Empty. Otherwise, returns the result OptionalValue<R> containing the result of applying the function f to the value contained in the provided optional value.

CompiledName: Map

map2 f input1 input2
Signature: f:('T1 -> 'T2 -> 'R) -> input1:OptionalValue<'T1> -> input2:OptionalValue<'T2> -> OptionalValue<'R>
Type parameters: 'T1, 'T2, 'R Attributes:
[<CompiledName("Map2")>]

If both of the arguments contain value, apply the specified function to their values and return OptionalValue<R> with the result. Otherwise return OptionalValue.Missing.

CompiledName: Map2

ofNullable(value)
Signature: value:Nullable<'T> -> 'T opt
Type parameters: 'T Attributes:
[<CompiledName("OfNullable")>]

Creates OptionalValue<T> from a .NET Nullable<T> type.

CompiledName: OfNullable

ofOption(opt)
Signature: opt:'T option -> 'T opt
Type parameters: 'T

Turns a standard F# option<T> value into a corresponding OptionalValue<T>

ofTuple(b, value)
Signature: (b:bool * value:'T) -> 'T opt
Type parameters: 'T Attributes:
[<CompiledName("OfTuple")>]

Creates OptionalValue<T> from a tuple of type bool * 'T. This function can be used with .NET methods that use out arguments. For example:

1: 
Int32.TryParse("42") |> OptionalValue.ofTuple

CompiledName: OfTuple

Active patterns

Active patternDescription
( |Missing|Present| )(optional)
Signature: optional:'T opt -> Choice<unit,'T>
Type parameters: 'T

Complete active pattern that can be used to pattern match on OptionalValue<T>. For example:

1: 
2: 
3: 
4: 
let optVal = OptionalValue(42)
match optVal with
| OptionalValue.Missing -> printfn "Empty"
| OptionalValue.Present(v) -> printfn "Contains %d" v
val optVal : obj
val printfn : format:Printf.TextWriterFormat<'T> -> 'T

CompiledName: |Missing|Present|

Fork me on GitHub