Header menu logo FSharp.Core

Patterns Module

Contains a set of primitive F# active patterns to analyze F# expression objects

Active patterns

Active pattern Description

(|AddressOf|_|) input

Full Usage: (|AddressOf|_|) input

Parameters:
    input : Expr - The input expression to match against.

Returns: Expr option When successful, the pattern binds the sub-expression of the input AddressOf expression

An active pattern to recognize expressions that represent getting the address of a value

input : Expr

The input expression to match against.

Returns: Expr option

When successful, the pattern binds the sub-expression of the input AddressOf expression

(|AddressSet|_|) input

Full Usage: (|AddressSet|_|) input

Parameters:
    input : Expr - The input expression to match against.

Returns: (Expr * Expr) option When successful, the pattern binds the target and value expressions of the input expression

An active pattern to recognize expressions that represent setting the value held at an address

input : Expr

The input expression to match against.

Returns: (Expr * Expr) option

When successful, the pattern binds the target and value expressions of the input expression

(|Application|_|) input

Full Usage: (|Application|_|) input

Parameters:
    input : Expr - The input expression to match against.

Returns: (Expr * Expr) option When successful, the pattern binds the function and argument of the input expression

An active pattern to recognize expressions that represent applications of first class function values

input : Expr

The input expression to match against.

Returns: (Expr * Expr) option

When successful, the pattern binds the function and argument of the input expression

(|CallWithWitnesses|_|) input

Full Usage: (|CallWithWitnesses|_|) input

Parameters:
    input : Expr - The input expression to match against.

Returns: (Expr option * MethodInfo * MethodInfo * Expr list * Expr list) option When successful, the pattern binds the object, method, witness-argument and argument sub-expressions of the input expression

An active pattern to recognize expressions that represent calls to static and instance methods, and functions defined in modules, including witness arguments

input : Expr

The input expression to match against.

Returns: (Expr option * MethodInfo * MethodInfo * Expr list * Expr list) option

When successful, the pattern binds the object, method, witness-argument and argument sub-expressions of the input expression

(|Call|_|) input

Full Usage: (|Call|_|) input

Parameters:
    input : Expr - The input expression to match against.

Returns: (Expr option * MethodInfo * Expr list) option When successful, the pattern binds the object, method and argument sub-expressions of the input expression

An active pattern to recognize expressions that represent calls to static and instance methods, and functions defined in modules

input : Expr

The input expression to match against.

Returns: (Expr option * MethodInfo * Expr list) option

When successful, the pattern binds the object, method and argument sub-expressions of the input expression

(|Coerce|_|) input

Full Usage: (|Coerce|_|) input

Parameters:
    input : Expr - The input expression to match against.

Returns: (Expr * Type) option When successful, the pattern binds the source expression and target type of the input expression

An active pattern to recognize expressions that represent coercions from one type to another

input : Expr

The input expression to match against.

Returns: (Expr * Type) option

When successful, the pattern binds the source expression and target type of the input expression

(|DefaultValue|_|) input

Full Usage: (|DefaultValue|_|) input

Parameters:
    input : Expr - The input expression to match against.

Returns: Type option When successful, the pattern binds the relevant type of the input expression

An active pattern to recognize expressions that represent invocations of a default constructor of a struct

input : Expr

The input expression to match against.

Returns: Type option

When successful, the pattern binds the relevant type of the input expression

(|FieldGet|_|) input

Full Usage: (|FieldGet|_|) input

Parameters:
    input : Expr - The input expression to match against.

Returns: (Expr option * FieldInfo) option When successful, the pattern binds the object and field of the input expression

An active pattern to recognize expressions that represent getting a static or instance field

input : Expr

The input expression to match against.

Returns: (Expr option * FieldInfo) option

When successful, the pattern binds the object and field of the input expression

(|FieldSet|_|) input

Full Usage: (|FieldSet|_|) input

Parameters:
    input : Expr - The input expression to match against.

Returns: (Expr option * FieldInfo * Expr) option When successful, the pattern binds the object, field and value of the input expression

An active pattern to recognize expressions that represent setting a static or instance field

input : Expr

The input expression to match against.

Returns: (Expr option * FieldInfo * Expr) option

When successful, the pattern binds the object, field and value of the input expression

(|ForIntegerRangeLoop|_|) input

Full Usage: (|ForIntegerRangeLoop|_|) input

Parameters:
    input : Expr - The input expression to match against.

Returns: (Var * Expr * Expr * Expr) option When successful, the pattern binds the value, start, finish and body of the input expression

An active pattern to recognize expressions that represent loops over integer ranges

input : Expr

The input expression to match against.

Returns: (Var * Expr * Expr * Expr) option

When successful, the pattern binds the value, start, finish and body of the input expression

(|IfThenElse|_|) input

Full Usage: (|IfThenElse|_|) input

Parameters:
    input : Expr - The input expression to match against.

Returns: (Expr * Expr * Expr) option When successful, the pattern binds the condition, then-branch and else-branch of the input expression

An active pattern to recognize expressions that represent conditionals

input : Expr

The input expression to match against.

Returns: (Expr * Expr * Expr) option

When successful, the pattern binds the condition, then-branch and else-branch of the input expression

(|Lambda|_|) input

Full Usage: (|Lambda|_|) input

Parameters:
    input : Expr - The input expression to match against.

Returns: (Var * Expr) option When successful, the pattern binds the variable and body of the input expression

An active pattern to recognize expressions that represent first class function values

input : Expr

The input expression to match against.

Returns: (Var * Expr) option

When successful, the pattern binds the variable and body of the input expression

(|LetRecursive|_|) input

Full Usage: (|LetRecursive|_|) input

Parameters:
    input : Expr - The input expression to match against.

Returns: ((Var * Expr) list * Expr) option When successful, the pattern binds the bindings and body of the input expression

An active pattern to recognize expressions that represent recursive let bindings of one or more variables

input : Expr

The input expression to match against.

Returns: ((Var * Expr) list * Expr) option

When successful, the pattern binds the bindings and body of the input expression

(|Let|_|) input

Full Usage: (|Let|_|) input

Parameters:
    input : Expr - The input expression to match against.

Returns: (Var * Expr * Expr) option When successful, the pattern binds the variable, binding expression and body of the input expression

An active pattern to recognize expressions that represent let bindings

input : Expr

The input expression to match against.

Returns: (Var * Expr * Expr) option

When successful, the pattern binds the variable, binding expression and body of the input expression

(|NewArray|_|) input

Full Usage: (|NewArray|_|) input

Parameters:
    input : Expr - The input expression to match against.

Returns: (Type * Expr list) option When successful, the pattern binds the element type and values of the input expression

An active pattern to recognize expressions that represent the construction of arrays

input : Expr

The input expression to match against.

Returns: (Type * Expr list) option

When successful, the pattern binds the element type and values of the input expression

(|NewDelegate|_|) input

Full Usage: (|NewDelegate|_|) input

Parameters:
    input : Expr - The input expression to match against.

Returns: (Type * Var list * Expr) option When successful, the pattern binds the delegate type, argument parameters and body of the input expression

An active pattern to recognize expressions that represent construction of delegate values

input : Expr

The input expression to match against.

Returns: (Type * Var list * Expr) option

When successful, the pattern binds the delegate type, argument parameters and body of the input expression

(|NewObject|_|) input

Full Usage: (|NewObject|_|) input

Parameters:
    input : Expr - The input expression to match against.

Returns: (ConstructorInfo * Expr list) option When successful, the pattern binds the constructor and arguments of the input expression

An active pattern to recognize expressions that represent invocation of object constructors

input : Expr

The input expression to match against.

Returns: (ConstructorInfo * Expr list) option

When successful, the pattern binds the constructor and arguments of the input expression

(|NewRecord|_|) input

Full Usage: (|NewRecord|_|) input

Parameters:
    input : Expr - The input expression to match against.

Returns: (Type * Expr list) option When successful, the pattern binds the record type and field values of the input expression

An active pattern to recognize expressions that represent construction of record values

input : Expr

The input expression to match against.

Returns: (Type * Expr list) option

When successful, the pattern binds the record type and field values of the input expression

(|NewStructTuple|_|) input

Full Usage: (|NewStructTuple|_|) input

Parameters:
    input : Expr - The input expression to match against.

Returns: Expr list option When successful, the pattern binds the element expressions of the input expression

An active pattern to recognize expressions that represent construction of struct tuple values

input : Expr

The input expression to match against.

Returns: Expr list option

When successful, the pattern binds the element expressions of the input expression

(|NewTuple|_|) input

Full Usage: (|NewTuple|_|) input

Parameters:
    input : Expr - The input expression to match against.

Returns: Expr list option When successful, the pattern binds the element expressions of the input expression

An active pattern to recognize expressions that represent construction of tuple values

input : Expr

The input expression to match against.

Returns: Expr list option

When successful, the pattern binds the element expressions of the input expression

(|NewUnionCase|_|) input

Full Usage: (|NewUnionCase|_|) input

Parameters:
    input : Expr - The input expression to match against.

Returns: (UnionCaseInfo * Expr list) option When successful, the pattern binds the union case and field values of the input expression

An active pattern to recognize expressions that represent construction of particular union case values

input : Expr

The input expression to match against.

Returns: (UnionCaseInfo * Expr list) option

When successful, the pattern binds the union case and field values of the input expression

(|PropertyGet|_|) input

Full Usage: (|PropertyGet|_|) input

Parameters:
    input : Expr - The input expression to match against.

Returns: (Expr option * PropertyInfo * Expr list) option When successful, the pattern binds the object, property and indexer arguments of the input expression

An active pattern to recognize expressions that represent the read of a static or instance property, or a non-function value declared in a module

input : Expr

The input expression to match against.

Returns: (Expr option * PropertyInfo * Expr list) option

When successful, the pattern binds the object, property and indexer arguments of the input expression

(|PropertySet|_|) input

Full Usage: (|PropertySet|_|) input

Parameters:
    input : Expr - The input expression to match against.

Returns: (Expr option * PropertyInfo * Expr list * Expr) option When successful, the pattern binds the object, property, indexer arguments and setter value of the input expression

An active pattern to recognize expressions that represent setting a static or instance property, or a non-function value declared in a module

input : Expr

The input expression to match against.

Returns: (Expr option * PropertyInfo * Expr list * Expr) option

When successful, the pattern binds the object, property, indexer arguments and setter value of the input expression

(|QuoteRaw|_|) input

Full Usage: (|QuoteRaw|_|) input

Parameters:
    input : Expr - The input expression to match against.

Returns: Expr option When successful, the pattern binds the nested quotation expression of the input expression

An active pattern to recognize expressions that represent a nested raw quotation literal

input : Expr

The input expression to match against.

Returns: Expr option

When successful, the pattern binds the nested quotation expression of the input expression

(|QuoteTyped|_|) input

Full Usage: (|QuoteTyped|_|) input

Parameters:
    input : Expr - The input expression to match against.

Returns: Expr option When successful, the pattern binds the nested quotation expression of the input expression

An active pattern to recognize expressions that represent a nested typed quotation literal

input : Expr

The input expression to match against.

Returns: Expr option

When successful, the pattern binds the nested quotation expression of the input expression

(|Sequential|_|) input

Full Usage: (|Sequential|_|) input

Parameters:
    input : Expr - The input expression to match against.

Returns: (Expr * Expr) option When successful, the pattern binds the two sub-expressions of the input expression

An active pattern to recognize expressions that represent sequential execution of one expression followed by another

input : Expr

The input expression to match against.

Returns: (Expr * Expr) option

When successful, the pattern binds the two sub-expressions of the input expression

(|TryFinally|_|) input

Full Usage: (|TryFinally|_|) input

Parameters:
    input : Expr - The input expression to match against.

Returns: (Expr * Expr) option When successful, the pattern binds the body and handler parts of the try/finally expression

An active pattern to recognize expressions that represent a try/finally construct

input : Expr

The input expression to match against.

Returns: (Expr * Expr) option

When successful, the pattern binds the body and handler parts of the try/finally expression

(|TryWith|_|) input

Full Usage: (|TryWith|_|) input

Parameters:
    input : Expr - The input expression to match against.

Returns: (Expr * Var * Expr * Var * Expr) option When successful, the pattern binds the body, exception variable, filter expression and catch expression of the input expression

An active pattern to recognize expressions that represent a try/with construct for exception filtering and catching

input : Expr

The input expression to match against.

Returns: (Expr * Var * Expr * Var * Expr) option

When successful, the pattern binds the body, exception variable, filter expression and catch expression of the input expression

(|TupleGet|_|) input

Full Usage: (|TupleGet|_|) input

Parameters:
    input : Expr - The input expression to match against.

Returns: (Expr * int) option When successful, the pattern binds the expression and tuple field being accessed

An active pattern to recognize expressions that represent getting a tuple field

input : Expr

The input expression to match against.

Returns: (Expr * int) option

When successful, the pattern binds the expression and tuple field being accessed

(|TypeTest|_|) input

Full Usage: (|TypeTest|_|) input

Parameters:
    input : Expr - The input expression to match against.

Returns: (Expr * Type) option When successful, the pattern binds the expression and type being tested

An active pattern to recognize expressions that represent a dynamic type test

input : Expr

The input expression to match against.

Returns: (Expr * Type) option

When successful, the pattern binds the expression and type being tested

(|UnionCaseTest|_|) input

Full Usage: (|UnionCaseTest|_|) input

Parameters:
    input : Expr - The input expression to match against.

Returns: (Expr * UnionCaseInfo) option When successful, the pattern binds the expression and union case being tested

An active pattern to recognize expressions that represent a test if a value is of a particular union case

input : Expr

The input expression to match against.

Returns: (Expr * UnionCaseInfo) option

When successful, the pattern binds the expression and union case being tested

(|ValueWithName|_|) input

Full Usage: (|ValueWithName|_|) input

Parameters:
    input : Expr - The input expression to match against.

Returns: (obj * Type * string) option When successful, the pattern binds the boxed value, its static type and its name

An active pattern to recognize expressions that represent a constant value

input : Expr

The input expression to match against.

Returns: (obj * Type * string) option

When successful, the pattern binds the boxed value, its static type and its name

(|Value|_|) input

Full Usage: (|Value|_|) input

Parameters:
    input : Expr - The input expression to match against.

Returns: (obj * Type) option When successful, the pattern binds the boxed value and its static type

An active pattern to recognize expressions that represent a constant value. This also matches expressions matched by ValueWithName.

input : Expr

The input expression to match against.

Returns: (obj * Type) option

When successful, the pattern binds the boxed value and its static type

(|VarSet|_|) input

Full Usage: (|VarSet|_|) input

Parameters:
    input : Expr - The input expression to match against.

Returns: (Var * Expr) option When successful, the pattern binds the variable and value expression of the input expression

An active pattern to recognize expressions that represent setting a mutable variable

input : Expr

The input expression to match against.

Returns: (Var * Expr) option

When successful, the pattern binds the variable and value expression of the input expression

(|Var|_|) input

Full Usage: (|Var|_|) input

Parameters:
    input : Expr - The input expression to match against.

Returns: Var option When successful, the pattern binds the variable of the input expression

An active pattern to recognize expressions that represent a variable

input : Expr

The input expression to match against.

Returns: Var option

When successful, the pattern binds the variable of the input expression

(|WhileLoop|_|) input

Full Usage: (|WhileLoop|_|) input

Parameters:
    input : Expr - The input expression to match against.

Returns: (Expr * Expr) option When successful, the pattern binds the guard and body of the input expression

An active pattern to recognize expressions that represent while loops

input : Expr

The input expression to match against.

Returns: (Expr * Expr) option

When successful, the pattern binds the guard and body of the input expression

(|WithValue|_|) input

Full Usage: (|WithValue|_|) input

Parameters:
    input : Expr - The input expression to match against.

Returns: (obj * Type * Expr) option When successful, the pattern binds the boxed value, its static type and its definition

An active pattern to recognize expressions that are a value with an associated definition

input : Expr

The input expression to match against.

Returns: (obj * Type * Expr) option

When successful, the pattern binds the boxed value, its static type and its definition

Type something to start searching.