ExtraTopLevelOperators Module
A set of extra operators and functions. This module is automatically opened in all F# code.
Nested modules
Modules | Description |
|
Functions and values
Function or value |
Description
|
|
Special prefix operator for splicing untyped expressions into quotation holes.
Example
val f: v: Quotations.Expr -> Quotations.Expr
val v: Quotations.Expr
Multiple items
Evaluates to an untyped quotation equivalent to val int: value: 'T -> int (requires member op_Explicit) -------------------- type int = int32 -------------------- type int<'Measure> = int <@@ (5 + 5) + (5 + 5) @@>
|
|
Special prefix operator for splicing typed expressions into quotation holes.
Example
val f: v: Quotations.Expr<int> -> Quotations.Expr<int>
val v: Quotations.Expr<int>
Evaluates to a quotation equivalent to <@ (5 + 5) + (5 + 5) @>
|
|
Builds a 2D array from a sequence of sequences of elements.
Example
val array2D: rows: #('T seq) seq -> 'T array2d
Evaluates to a 2x2 zero-based array with contents [[1.0; 2.0]; [3.0; 4.0]]
|
|
Builds an asynchronous workflow using computation expression syntax.
Example
val sleepExample: unit -> Async<int>
val async: AsyncBuilder
val printfn: format: Printf.TextWriterFormat<'T> -> 'T
Multiple items
type Async = static member AsBeginEnd: computation: ('Arg -> Async<'T>) -> ('Arg * AsyncCallback * obj -> IAsyncResult) * (IAsyncResult -> 'T) * (IAsyncResult -> unit) static member AwaitEvent: event: IEvent<'Del,'T> * ?cancelAction: (unit -> unit) -> Async<'T> (requires delegate and 'Del :> Delegate) static member AwaitIAsyncResult: iar: IAsyncResult * ?millisecondsTimeout: int -> Async<bool> static member AwaitTask: task: Task<'T> -> Async<'T> + 1 overload static member AwaitWaitHandle: waitHandle: WaitHandle * ?millisecondsTimeout: int -> Async<bool> static member CancelDefaultToken: unit -> unit static member Catch: computation: Async<'T> -> Async<Choice<'T,exn>> static member Choice: computations: Async<'T option> seq -> Async<'T option> static member FromBeginEnd: beginAction: (AsyncCallback * obj -> IAsyncResult) * endAction: (IAsyncResult -> 'T) * ?cancelAction: (unit -> unit) -> Async<'T> + 3 overloads static member FromContinuations: callback: (('T -> unit) * (exn -> unit) * (OperationCanceledException -> unit) -> unit) -> Async<'T> ... -------------------- type Async<'T> static member Async.Sleep: dueTime: System.TimeSpan -> Async<unit>
static member Async.Sleep: millisecondsDueTime: int -> Async<unit> static member Async.RunSynchronously: computation: Async<'T> * ?timeout: int * ?cancellationToken: System.Threading.CancellationToken -> 'T
|
Full Usage:
dict keyValuePairs
Parameters:
('Key * 'Value) seq
Returns: IDictionary<'Key, 'Value>
|
Builds a read-only lookup table from a sequence of key/value pairs. The key objects are indexed using generic hashing and equality.
Example
val table: System.Collections.Generic.IDictionary<int,int>
val dict: keyValuePairs: ('Key * 'Value) seq -> System.Collections.Generic.IDictionary<'Key,'Value> (requires equality)
Evaluates to 100 .
Example
val table: System.Collections.Generic.IDictionary<int,int>
val dict: keyValuePairs: ('Key * 'Value) seq -> System.Collections.Generic.IDictionary<'Key,'Value> (requires equality)
Throws System.Collections.Generic.KeyNotFoundException .
|
Full Usage:
double value
Parameters:
^T
Returns: double
Modifiers: inline Type parameters: ^T |
Converts the argument to 64-bit float.
This is a direct conversion for all
primitive numeric types. For strings, the input is converted using
Example
Multiple items
Evaluates to val double: value: 'T -> double (requires member op_Explicit) -------------------- type double = System.Double -------------------- type double<'Measure> = float<'Measure> 45.0 .
Example
Multiple items
Evaluates to val double: value: 'T -> double (requires member op_Explicit) -------------------- type double = System.Double -------------------- type double<'Measure> = float<'Measure> 12.30000019 .
|
Full Usage:
eprintf format
Parameters:
TextWriterFormat<'T>
-
The formatter.
Returns: 'T
The formatted result.
|
Print to
Example
See |
Full Usage:
eprintfn format
Parameters:
TextWriterFormat<'T>
-
The formatter.
Returns: 'T
The formatted result.
|
Print to
Example
See |
Full Usage:
failwithf format
Parameters:
StringFormat<'T, 'Result>
-
The formatter.
Returns: 'T
The formatted result.
|
Print to a string buffer and raise an exception with the given result. Helper printers must return strings.
Example
See |
Full Usage:
fprintf textWriter format
Parameters:
TextWriter
-
The file TextWriter.
format : TextWriterFormat<'T>
-
The formatter.
Returns: 'T
The formatted result.
|
Print to a file using the given format.
Example
See |
Full Usage:
fprintfn textWriter format
Parameters:
TextWriter
-
The file TextWriter.
format : TextWriterFormat<'T>
-
The formatter.
Returns: 'T
The formatted result.
|
Print to a file using the given format, and add a newline.
Example
See |
|
Converts the argument to signed byte.
This is a direct conversion for all
primitive numeric types. For strings, the input is converted using
Example
Multiple items
Evaluates to val int8: value: 'T -> int8 (requires member op_Explicit) -------------------- type int8 = System.SByte -------------------- type int8<'Measure> = sbyte<'Measure> -12y .
Example
Multiple items
Evaluates to val int8: value: 'T -> int8 (requires member op_Explicit) -------------------- type int8 = System.SByte -------------------- type int8<'Measure> = sbyte<'Measure> 3y .
|
Full Usage:
printf format
Parameters:
TextWriterFormat<'T>
-
The formatter.
Returns: 'T
The formatted result.
|
Print to
Example
See |
Full Usage:
printfn format
Parameters:
TextWriterFormat<'T>
-
The formatter.
Returns: 'T
The formatted result.
|
Print to
Example
See |
|
Builds a query using query syntax and operators.
Example
val findEvensAndSortAndDouble: xs: System.Linq.IQueryable<int> -> System.Linq.IQueryable<int>
val xs: System.Linq.IQueryable<int>
namespace System
namespace System.Linq
Multiple items
type IQueryable = inherit IEnumerable member ElementType: Type member Expression: Expression member Provider: IQueryProvider <summary>Provides functionality to evaluate queries against a specific data source wherein the type of the data is not specified.</summary> -------------------- type IQueryable<'T> = inherit IEnumerable<'T> inherit IEnumerable inherit IQueryable <summary>Provides functionality to evaluate queries against a specific data source wherein the type of the data is known.</summary> <typeparam name="T">The type of the data in the data source.</typeparam> Multiple items
val int: value: 'T -> int (requires member op_Explicit) -------------------- type int = int32 -------------------- type int<'Measure> = int val query: Linq.QueryBuilder
val x: int
custom operation: where (bool)
Calls Linq.QueryBuilder.Where
custom operation: sortBy ('Key)
Calls Linq.QueryBuilder.SortBy
custom operation: select ('Result)
Calls Linq.QueryBuilder.Select
val data: int list
module Seq
from Microsoft.FSharp.Collections
val toList: source: 'T seq -> 'T list
Evaluates to [4; 4; 12; 12] .
|
Full Usage:
readOnlyDict keyValuePairs
Parameters:
('Key * 'Value) seq
Returns: IReadOnlyDictionary<'Key, 'Value>
|
Builds a read-only lookup table from a sequence of key/value pairs. The key objects are indexed using generic hashing and equality.
Example
val table: System.Collections.Generic.IReadOnlyDictionary<int,int>
val readOnlyDict: keyValuePairs: ('Key * 'Value) seq -> System.Collections.Generic.IReadOnlyDictionary<'Key,'Value> (requires equality)
Evaluates to 100 .
Example
val table: System.Collections.Generic.IReadOnlyDictionary<int,int>
val readOnlyDict: keyValuePairs: ('Key * 'Value) seq -> System.Collections.Generic.IReadOnlyDictionary<'Key,'Value> (requires equality)
Throws System.Collections.Generic.KeyNotFoundException .
|
|
Builds a set from a sequence of objects. The objects are indexed using generic comparison.
Example
val values: Set<int>
val set: elements: 'T seq -> Set<'T> (requires comparison)
Evaluates to a set containing the given numbers.
|
Full Usage:
single value
Parameters:
^T
Returns: single
Modifiers: inline Type parameters: ^T |
Converts the argument to 32-bit float.
This is a direct conversion for all
primitive numeric types. For strings, the input is converted using
Example
Multiple items
Evaluates to val single: value: 'T -> single (requires member op_Explicit) -------------------- type single = System.Single -------------------- type single<'Measure> = float32<'Measure> 45.0f .
|
Full Usage:
sprintf format
Parameters:
StringFormat<'T>
-
The formatter.
Returns: 'T
The formatted result.
|
Print to a string using the given format.
Example
See |
|
Converts the argument to byte.
This is a direct conversion for all
primitive numeric types. For strings, the input is converted using
Example
Multiple items
Evaluates to val uint8: value: 'T -> uint8 (requires member op_Explicit) -------------------- type uint8 = System.Byte -------------------- type uint8<'Measure> = byte<'Measure> 12uy .
|
Active patterns
Active pattern |
Description
|
|
An active pattern to force the execution of values of type
Example
val f: Lazy<int> -> int
Multiple items
active recognizer Lazy: Lazy<'T> -> 'T -------------------- type Lazy<'T> = System.Lazy<'T> val v: int
val v: Lazy<int>
val printf: format: Printf.TextWriterFormat<'T> -> 'T
Evaluates to 10 . The text eval! is printed once on the first invocation of f .
|