Header menu logo FSharp.Core.Fluent

OptionExtensions Module

Fluent extension operations on options.

Type extensions

Type extension Description

this.bind binder

Full Usage: this.bind binder

Parameters:
    binder : '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

bind f inp evaluates to match inp with None -> None | Some x -> f x

Extended Type: Option

binder : '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.

this.count ()

Full Usage: this.count ()

Parameters:
    () : unit

Returns: int A zero if the option is None, a one otherwise.
Modifiers: inline

Evaluates to match inp with None -> 0 | Some _ -> 1.

Extended Type: Option

() : unit
Returns: int

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

this.count

Full Usage: this.count

Returns: int A zero if the option is None, a one otherwise.
Modifiers: inline

Evaluates to match inp with None -> 0 | Some _ -> 1.

Extended Type: Option

Returns: int

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

this.exists predicate

Full Usage: this.exists predicate

Parameters:
    predicate : '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

exists p inp evaluates to match inp with None -> false | Some x -> p x.

Extended Type: Option

predicate : '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.

this.filter predicate

Full Usage: this.filter predicate

Parameters:
    predicate : '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

filter f inp evaluates to match inp with None -> None | Some x -> if f x then Some x else None.

Extended Type: Option

predicate : '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.

this.fold (state, folder)

Full Usage: this.fold (state, folder)

Parameters:
    state : '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

fold f s inp evaluates to match inp with None -> s | Some x -> f s x.

Extended Type: Option

state : '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.

this.foldBack (folder, state)

Full Usage: this.foldBack (folder, state)

Parameters:
    folder : '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

fold f inp s evaluates to match inp with None -> s | Some x -> f x s.

Extended Type: Option

folder : '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.

this.forall predicate

Full Usage: this.forall predicate

Parameters:
    predicate : '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

forall p inp evaluates to match inp with None -> true | Some x -> p x.

Extended Type: Option

predicate : '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.

this.iter action

Full Usage: this.iter action

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

Modifiers: inline

iter f inp executes match inp with None -> () | Some x -> f x.

Extended Type: Option

action : 'T -> unit

A function to apply to the option value.

this.map mapping

Full Usage: this.map mapping

Parameters:
    mapping : '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

map f inp evaluates to match inp with None -> None | Some x -> Some (f x).

Extended Type: Option

mapping : '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.

this.toArray ()

Full Usage: this.toArray ()

Parameters:
    () : unit

Returns: 'T[] The result array.
Modifiers: inline

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

Extended Type: Option

() : unit
Returns: 'T[]

The result array.

this.toList ()

Full Usage: this.toList ()

Parameters:
    () : unit

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

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

Extended Type: Option

() : unit
Returns: 'T list

The result list.

Type something to start searching.