Share via


Microsoft.FSharp.Core Namespace (F#)

This namespace contains functionality that supports core F# functionality, including language primitives, operators, attributes, primitive types, strings, and formatted I/O.

Namespace/Module Path: Microsoft.FSharp.Core

Assembly: FSharp.Core (in FSharp.Core.dll)

namespace Microsoft.FSharp.Core

Modules

Module

Description

module ExtraTopLevelOperators

Additional F# operators and types that are available without opening a module or namespace.

module LanguagePrimitives

Language primitives associated with the F# language

module NumericLiterals

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

module Operators

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

module OptimizedClosures

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

module Option

Basic operations on options.

module Printf

Extensible printf-style formatting for numbers and other datatypes

module String

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

Type Definitions

Type

Description

type [,,,]<'T>

Four dimensional arrays, typically zero-based. Non-zero-based arrays can be created using methods on the System.Array type.

type [,,]<'T>

Three dimensional arrays, typically zero-based. Non-zero-based arrays can be created using methods on the System.Array type.

type [,]<'T>

Two dimensional arrays, typically zero-based.

type []<'T>

Single dimensional, zero-based arrays, written int[], string[] and so on.

type 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.

type 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.

type AutoOpenAttribute

This attribute is used for two purposes. When applied to an assembly, it must be given a string argument, and this argument must indicate a valid module or namespace in that assembly. Source code files compiled with a reference to this assembly are processed in an environment where the given path is automatically oepned.

type AutoSerializableAttribute

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

type byref<'T>

Represents a managed pointer in F# code.

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

Helper types for active patterns with 7 choices.

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

Helper types for active patterns with 6 choices.

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

Helper types for active patterns with 5 choices.

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

Helper types for active patterns with 4 choices.

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

Helper types for active patterns with 3 choices.

type Choice<'T1,'T2>

Helper types for active patterns with 2 choices.

type ClassAttribute

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

type 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.

type 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.

type 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. For example, adding this attribute to parameter 'T on a type definition C<'T> means that a type C<X> only supports comparison if the type X also supports comparison and all other conditions for C<X> to support comparison are also met. The type C<'T> can still be used with other type arguments, but a type such as C<(int -> int)> will not support comparison because the type (int -> int) is an F# function type and does not support comparison.

type 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

type 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. It is used by the functions in the Microsoft.FSharp.Reflection namespace to reverse-map compiled constructs to their original forms. It is not intended for use from user code.

type 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.

type CompilationRepresentationFlags

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

type CompilationSourceNameAttribute

This attribute is inserted automatically by the F# compiler to tag methods which are given the 'CompiledName' attribute. It is not intended for use from user code.

type 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.

type CompilerMessageAttribute

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

type CustomComparisonAttribute

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

type CustomEqualityAttribute

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

type CustomOperationAttribute

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

type 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 System.Decimal.

type 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.

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.

type EntryPointAttribute

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

type 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. For example, adding this attribute to parameter 'T on a type definition C<'T> means that a type C<X> only supports equality if the type X also supports equality and all other conditions for C<X> to support equality are also met. The type C<'T> can still be used with other type arguments, but a type such as C<(int -> int)> will not support equality because the type (int -> int) is an F# function type and does not support equality.

type ExperimentalAttribute

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

type float<'Measure>

The type of 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 System.Double.

type float32<'Measure>

The type of 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 System.Single.

type 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.

type 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.

type FSharpTypeFunc

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

type FuncConvert

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

type 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.

type ilsigptr<'T>

This type is for internal use by the F# code generator.

type 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 System.Int32.

type 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 System.Int16.

type 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 System.Int64.

type InterfaceAttribute

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

type LiteralAttribute

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

type 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.

type 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.

type nativeptr<'T>

Represents an unmanaged pointer in F# code.

type 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.

type 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.

type 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.

type Option<'T>

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

type OptionalArgumentAttribute

This attribute is added automatically for all optional arguments.

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

Type of a formatting expression.

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

Type of a formatting expression.

type 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.

type Ref<'T>

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

type 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.

type 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.

type RequireQualifiedAccessAttribute

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

type RequiresExplicitTypeArgumentsAttribute

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

type 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 System.SByte.

type SealedAttribute

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

type SourceConstructFlags

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

type StructAttribute

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

type StructuralComparisonAttribute

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

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.

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# the only valid values are of the form PreText {PropertyName} PostText. The property name indicates a property to evaluate and to display instead of the object itself.

type Unit

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

type 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.

type VolatileFieldAttribute

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

Type Abbreviations

Type

Description

type array<'T>

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

type bigint

Arbitrarily large integers. An abbreviation for the type BigInteger.

type bool

An abbreviation for the CLI type Boolean.

type byte

An abbreviation for the CLI type Byte.

type char

An abbreviation for the CLI type Char.

type decimal

An abbreviation for the CLI type Decimal.

type double

An abbreviation for the CLI type Double.

type exn

An abbreviation for the CLI type Exception.

type float

An abbreviation for the CLI type Double.

type float32

An abbreviation for the CLI type Single.

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

Type of a formatting expression.

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

Type of a formatting expression.

type int

An abbreviation for the CLI type Int32.

type int16

An abbreviation for the CLI type Int16.

type int32

An abbreviation for the CLI type Int32.

type int64

An abbreviation for the CLI type Int64.

type int8

An abbreviation for the CLI type SByte.

type nativeint

An abbreviation for the CLI type IntPtr.

type obj

An abbreviation for the CLI type Object.

type option<'T>

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

type ref<'T>

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

type sbyte

An abbreviation for the CLI type SByte.

type single

An abbreviation for the CLI type Single.

type string

An abbreviation for the CLI type String.

type uint16

An abbreviation for the CLI type UInt16.

type uint32

An abbreviation for the CLI type UInt32.

type uint64

An abbreviation for the CLI type UInt64.

type uint8

An abbreviation for the CLI type Byte.

type unativeint

An abbreviation for the CLI type UIntPtr.

type unit

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

Exceptions

Exception

Description

exception MatchFailureException

Non-exhaustive match failures will raise the MatchFailureException exception

See Also

Other Resources

F# Core Library Reference