Header menu logo FSharp.Core

FSharp.Core Namespace

Basic definitions of operators, options, functions, results, choices, attributes and plain text formatting.

Contents

Basic Types

Type Description

'T array

Single dimensional, zero-based arrays, written int array, string array etc.

bool

An abbreviation for the CLI type Boolean.

byte

An abbreviation for the CLI type Byte.

char

An abbreviation for the CLI type Char.

double

An abbreviation for the CLI type Double. Identical to float.

float

An abbreviation for the CLI type Double.

float32

An abbreviation for the CLI type Single.

int

An abbreviation for the CLI type Int32.

int16

An abbreviation for the CLI type Int16.

int32

An abbreviation for the CLI type Int32.

int64

An abbreviation for the CLI type Int64.

int8

An abbreviation for the CLI type SByte.

obj

An abbreviation for the CLI type Object.

objnull

An abbreviation for the CLI type Object or null. With the 'nullable reference types' feature, this is an alias to 'obj | null'.

'T ref

The type of mutable references. Use the functions [!] and [:=] to get and set values of this type.

sbyte

An abbreviation for the CLI type SByte.

single

An abbreviation for the CLI type Single. Identical to float32.

uint

An abbreviation for the CLI type UInt32.

uint16

An abbreviation for the CLI type UInt16.

uint32

An abbreviation for the CLI type UInt32.

uint64

An abbreviation for the CLI type UInt64.

uint8

An abbreviation for the CLI type Byte.

unit

The type 'unit', which has only one value "()". This value is special and always uses the representation 'null'.

Basic Operators

Modules Description

ExtraTopLevelOperators

A set of extra operators and functions. This module is automatically opened in all F# code.

Operators

Basic F# Operators. This module is automatically opened in all F# code.

Options

Type/Module Description

Option

Contains operations for working with options.

'T option

The type of optional values. When used from other CLI languages the empty option is the null value.

ValueOption

Contains operations for working with value options.

'T voption

The type of optional values, represented as structs.

Strings and Text

Modules Description

Printf

Extensible printf-style formatting for numbers and other datatypes

String

Functional programming operators for string processing. Further string operations are available via the member functions on strings and other functionality in System.String and System.Text.RegularExpressions types.

Choices and Results

Type/Module Description

Choice<'T1, 'T2>

Helper types for active patterns with 2 choices.

Choice<'T1, 'T2, 'T3>

Helper types for active patterns with 3 choices.

Choice<'T1, 'T2, 'T3, 'T4>

Helper types for active patterns with 4 choices.

Choice<'T1, 'T2, 'T3, 'T4, 'T5>

Helper types for active patterns with 5 choices.

Choice<'T1, 'T2, 'T3, 'T4, 'T5, 'T6>

Helper types for active patterns with 6 choices.

Choice<'T1, 'T2, 'T3, 'T4, 'T5, 'T6, 'T7>

Helper types for active patterns with 7 choices.

Result

Contains operations for working with values of type Result.

Result<'T, 'TError>

Helper type for error handling without exceptions.

Basic Types with Units of Measure

Type Description

byte<'Measure>

The type of 8-bit unsigned integer numbers, annotated with a unit of measure. The unit of measure is erased in compiled code and when values of this type are analyzed using reflection. The type is representationally equivalent to Byte.

decimal<'Measure>

The type of decimal numbers, annotated with a unit of measure. The unit of measure is erased in compiled code and when values of this type are analyzed using reflection. The type is representationally equivalent to Decimal.

double<'Measure>

The type of double-precision floating point numbers, annotated with a unit of measure. The unit of measure is erased in compiled code and when values of this type are analyzed using reflection. The type is representationally equivalent to Double.

float<'Measure>

The type of double-precision floating point numbers, annotated with a unit of measure. The unit of measure is erased in compiled code and when values of this type are analyzed using reflection. The type is representationally equivalent to Double.

float32<'Measure>

The type of single-precision floating point numbers, annotated with a unit of measure. The unit of measure is erased in compiled code and when values of this type are analyzed using reflection. The type is representationally equivalent to Single.

int<'Measure>

The type of 32-bit signed integer numbers, annotated with a unit of measure. The unit of measure is erased in compiled code and when values of this type are analyzed using reflection. The type is representationally equivalent to Int32.

int16<'Measure>

The type of 16-bit signed integer numbers, annotated with a unit of measure. The unit of measure is erased in compiled code and when values of this type are analyzed using reflection. The type is representationally equivalent to Int16.

int32<'Measure>

The type of 32-bit signed integer numbers, annotated with a unit of measure. The unit of measure is erased in compiled code and when values of this type are analyzed using reflection. The type is representationally equivalent to Int32.

int64<'Measure>

The type of 64-bit signed integer numbers, annotated with a unit of measure. The unit of measure is erased in compiled code and when values of this type are analyzed using reflection. The type is representationally equivalent to Int64.

int8<'Measure>

The type of 8-bit signed integer numbers, annotated with a unit of measure. The unit of measure is erased in compiled code and when values of this type are analyzed using reflection. The type is representationally equivalent to SByte.

nativeint<'Measure>

The type of machine-sized signed integer numbers, annotated with a unit of measure. The unit of measure is erased in compiled code and when values of this type are analyzed using reflection. The type is representationally equivalent to IntPtr.

sbyte<'Measure>

The type of 8-bit signed integer numbers, annotated with a unit of measure. The unit of measure is erased in compiled code and when values of this type are analyzed using reflection. The type is representationally equivalent to SByte.

single<'Measure>

The type of single-precision floating point numbers, annotated with a unit of measure. The unit of measure is erased in compiled code and when values of this type are analyzed using reflection. The type is representationally equivalent to Single.

uint<'Measure>

The type of 32-bit unsigned integer numbers, annotated with a unit of measure. The unit of measure is erased in compiled code and when values of this type are analyzed using reflection. The type is representationally equivalent to UInt32.

uint16<'Measure>

The type of 16-bit unsigned integer numbers, annotated with a unit of measure. The unit of measure is erased in compiled code and when values of this type are analyzed using reflection. The type is representationally equivalent to UInt16.

uint32<'Measure>

The type of 32-bit unsigned integer numbers, annotated with a unit of measure. The unit of measure is erased in compiled code and when values of this type are analyzed using reflection. The type is representationally equivalent to UInt32.

uint64<'Measure>

The type of 64-bit unsigned integer numbers, annotated with a unit of measure. The unit of measure is erased in compiled code and when values of this type are analyzed using reflection. The type is representationally equivalent to UInt64.

uint8<'Measure>

The type of 8-bit unsigned integer numbers, annotated with a unit of measure. The unit of measure is erased in compiled code and when values of this type are analyzed using reflection. The type is representationally equivalent to Byte.

unativeint<'Measure>

The type of machine-sized unsigned integer numbers, annotated with a unit of measure. The unit of measure is erased in compiled code and when values of this type are analyzed using reflection. The type is representationally equivalent to UIntPtr.

ByRef and Pointer Types

Type/Module Description

byref<'T>

Represents a managed pointer in F# code. For F# 4.5+ this is considered equivalent to byref<'T, ByRefKinds.InOut>

byref<'T, 'Kind>

Represents a managed pointer in F# code.

ByRefKinds

Represents the types of byrefs in F# 4.5+

ilsigptr<'T>

Represents an Common IL (Intermediate Language) Signature Pointer.

inref<'T>

Represents a in-argument or readonly managed pointer in F# code. This type should only be used with F# 4.5+.

nativeptr<'T>

Represents an unmanaged pointer in F# code.

outref<'T>

Represents a out-argument managed pointer in F# code. This type should only be used with F# 4.5+.

voidptr

Represents an untyped unmanaged pointer in F# code.

Attributes

Type Description

AbstractClassAttribute

Adding this attribute to class definition makes it abstract, which means it need not implement all its methods. Instances of abstract classes may not be constructed directly.

AllowNullLiteralAttribute

Adding this attribute to a type lets the 'null' literal be used for the type within F# code. This attribute may only be added to F#-defined class or interface types.

AutoOpenAttribute

Indicates a construct is automatically opened when brought into scope through an assembly reference or then opening of the containing namespace or module.

AutoSerializableAttribute

Adding this attribute to a type with value 'false' disables the behaviour where F# makes the type Serializable by default.

ClassAttribute

Adding this attribute to a type causes it to be represented using a CLI class.

CLIEventAttribute

Adding this attribute to a property with event type causes it to be compiled with as a CLI metadata event, through a syntactic translation to a pair of 'add_EventName' and 'remove_EventName' methods.

CLIMutableAttribute

Adding this attribute to a record type causes it to be compiled to a CLI representation with a default constructor with property getters and setters.

ComparisonConditionalOnAttribute

This attribute is used to indicate a generic container type satisfies the F# 'comparison' constraint only if a generic argument also satisfies this constraint.

CompilationArgumentCountsAttribute

This attribute is generated automatically by the F# compiler to tag functions and members that accept a partial application of some of their arguments and return a residual function.

CompilationMappingAttribute

This attribute is inserted automatically by the F# compiler to tag types and methods in the generated CLI code with flags indicating the correspondence with original source constructs.

CompilationRepresentationAttribute

This attribute is used to adjust the runtime representation for a type. For example, it may be used to note that the null representation may be used for a type. This affects how some constructs are compiled.

CompilationRepresentationFlags

Indicates one or more adjustments to the compiled representation of an F# type or member.

CompilationSourceNameAttribute

This attribute is inserted automatically by the F# compiler to tag methods which are given the 'CompiledName' attribute.

CompiledNameAttribute

Adding this attribute to a value or function definition in an F# module changes the name used for the value in compiled CLI code.

CompilerMessageAttribute

Indicates that a message should be emitted when F# source code uses this construct.

CustomComparisonAttribute

Adding this attribute to a type indicates it is a type with a user-defined implementation of comparison.

CustomEqualityAttribute

Adding this attribute to a type indicates it is a type with a user-defined implementation of equality.

CustomOperationAttribute

Indicates that a member on a computation builder type is a custom query operator, and indicates the name of that operator.

DefaultAugmentationAttribute

Adding this attribute to a discriminated union with value false turns off the generation of standard helper member tester, constructor and accessor members for the generated CLI class for that type.

DefaultValueAttribute

Adding this attribute to a field declaration means that the field is not initialized. During type checking a constraint is asserted that the field type supports 'null'. If the 'check' value is false then the constraint is not asserted.

EntryPointAttribute

Adding this attribute to a function indicates it is the entrypoint for an application. If this attribute is not specified for an EXE then the initialization implicit in the module bindings in the last file in the compilation sequence are used as the entrypoint.

EqualityConditionalOnAttribute

This attribute is used to indicate a generic container type satisfies the F# 'equality' constraint only if a generic argument also satisfies this constraint.

ExperimentalAttribute

This attribute is used to tag values that are part of an experimental library feature.

FSharpInterfaceDataVersionAttribute

This attribute is added to generated assemblies to indicate the version of the data schema used to encode additional F# specific information in the resource attached to compiled F# libraries.

GeneralizableValueAttribute

Adding this attribute to a non-function value with generic parameters indicates that uses of the construct can give rise to generic code through type inference.

InlineIfLambdaAttribute

Adding this attribute to a parameter of function type indicates that, if the overall function or method is inlined and the parameter is determined to be a known lambda, then this function should be statically inlined throughout the body of the function of method.

InterfaceAttribute

Adding this attribute to a type causes it to be represented using a CLI interface.

LiteralAttribute

Adding this attribute to a value causes it to be compiled as a CLI constant literal.

MeasureAnnotatedAbbreviationAttribute

Adding this attribute to a type causes it to be interpreted as a refined type, currently limited to measure-parameterized types. This may only be used under very limited conditions.

MeasureAttribute

Adding this attribute to a type causes it to be interpreted as a unit of measure. This may only be used under very limited conditions.

NoComparisonAttribute

Adding this attribute to a type indicates it is a type where comparison is an abnormal operation. This means that the type does not satisfy the F# 'comparison' constraint. Within the bounds of the F# type system, this helps ensure that the F# generic comparison function is not instantiated directly at this type. The attribute and checking does not constrain the use of comparison with base or child types of this type.

NoCompilerInliningAttribute

Indicates a value or a function that must not be inlined by the F# compiler, but may be inlined by the JIT compiler.

NoDynamicInvocationAttribute

This attribute is used to tag values that may not be dynamically invoked at runtime. This is typically added to inlined functions whose implementations include unverifiable code. It causes the method body emitted for the inlined function to raise an exception if dynamically invoked, rather than including the unverifiable code in the generated assembly.

NoEqualityAttribute

Adding this attribute to a type indicates it is a type where equality is an abnormal operation. This means that the type does not satisfy the F# 'equality' constraint. Within the bounds of the F# type system, this helps ensure that the F# generic equality function is not instantiated directly at this type. The attribute and checking does not constrain the use of comparison with base or child types of this type.

OptionalArgumentAttribute

This attribute is added automatically for all optional arguments.

ProjectionParameterAttribute

Indicates that, when a custom operator is used in a computation expression, a parameter is automatically parameterized by the variable space of the computation expression

ReferenceEqualityAttribute

Adding this attribute to a record or union type disables the automatic generation of overrides for 'System.Object.Equals(obj)', 'System.Object.GetHashCode()' and 'System.IComparable' for the type. The type will by default use reference equality.

ReflectedDefinitionAttribute

Adding this attribute to the let-binding for the definition of a top-level value makes the quotation expression that implements the value available for use at runtime.

RequireQualifiedAccessAttribute

This attribute is used to indicate that references to the elements of a module, record or union type require explicit qualified access.

RequiresExplicitTypeArgumentsAttribute

Adding this attribute to a type, value or member requires that uses of the construct must explicitly instantiate any generic type parameters.

SealedAttribute

Adding this attribute to class definition makes it sealed, which means it may not be extended or implemented.

SourceConstructFlags

Indicates the relationship between a compiled entity in a CLI binary and an element in F# source code.

StructAttribute

Adding this attribute to a type causes it to be represented using a CLI struct.

StructuralComparisonAttribute

Adding this attribute to a record, union, exception, or struct type confirms the automatic generation of implementations for 'System.IComparable' for the type.

StructuralEqualityAttribute

Adding this attribute to a record, union or struct type confirms the automatic generation of overrides for 'System.Object.Equals(obj)' and 'System.Object.GetHashCode()' for the type.

StructuredFormatDisplayAttribute

This attribute is used to mark how a type is displayed by default when using '%A' printf formatting patterns and other two-dimensional text-based display layouts. In this version of F# valid values are of the form PreText {PropertyName1} PostText {PropertyName2} ... {PropertyNameX} PostText. The property names indicate properties to evaluate and to display instead of the object itself.

TailCallAttribute

Indicates a function that should be called in a tail recursive way inside its recursive scope. A warning is emitted if the function is analyzed as not tail recursive after the optimization phase.

UnverifiableAttribute

This attribute is used to tag values whose use will result in the generation of unverifiable code. These values are inevitably marked 'inline' to ensure that the unverifiable constructs are not present in the actual code for the F# library, but are rather copied to the source code of the caller.

VolatileFieldAttribute

Adding this attribute to an F# mutable binding causes the "volatile" prefix to be used for all accesses to the field.

WarnOnWithoutNullArgumentAttribute

When used in a compilation with null-checking enabled, indicates that a function is meant to be used only with potentially-nullable values and warns accordingly.

Language Primitives

Type/Module Description

Format<'Printer, 'State, 'Residue, 'Result>

Type of a formatting expression.

Format<'Printer, 'State, 'Residue, 'Result, 'Tuple>

Type of a formatting expression.

FSharpFunc<'T, 'U>

The CLI type used to represent F# function values. This type is not typically used directly, though may be used from other CLI languages.

FSharpTypeFunc

The CLI type used to represent F# first-class type function values. This type is for use by compiled F# code.

FuncConvert

Helper functions for converting F# first class function values to and from CLI representations of functions using delegates.

LanguagePrimitives

Language primitives associated with the F# language

MatchFailureException

Non-exhaustive match failures will raise the MatchFailureException exception

NumericLiterals

Provides a default implementations of F# numeric literal syntax for literals of the form 'dddI'

OptimizedClosures

An implementation module used to hold some private implementations of function value invocation.

PrintfFormat<'Printer, 'State, 'Residue, 'Result>

Type of a formatting expression.

PrintfFormat<'Printer, 'State, 'Residue, 'Result, 'Tuple>

Type of a formatting expression.

Type something to start searching.