FSharp.Core Surface Area Diff (what is new)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[<AutoOpen>] | |
module Microsoft.FSharp.Reflection.FSharpReflectionExtensions | |
/// Creates an instance of a record type. | |
val MakeRecord : recordType:Type * values:obj [] * ?allowAccessToPrivateRepresentation:bool -> obj | |
/// Reads all the fields from a record value. | |
val GetRecordFields : record:obj * ?allowAccessToPrivateRepresentation:bool -> obj [] | |
/// Precompute a function for reading all the fields from a record. The fields are returned in the | |
/// same order as the fields reported by a call to Microsoft.FSharp.Reflection.Type.GetInfo for | |
/// this type. | |
val PreComputeRecordReader : recordType:Type * ?allowAccessToPrivateRepresentation:bool -> obj -> obj [] | |
/// Precompute a function for constructing a record value. | |
val PreComputeRecordConstructor : recordType:Type * ?allowAccessToPrivateRepresentation:bool -> obj [] -> obj | |
/// Get a ConstructorInfo for a record type | |
val PreComputeRecordConstructorInfo : recordType:Type * ?allowAccessToPrivateRepresentation:bool -> Reflection.ConstructorInfo | |
/// Create a union case value. | |
val MakeUnion : unionCase:Reflection.UnionCaseInfo * args:obj [] * ?allowAccessToPrivateRepresentation:bool -> obj | |
/// Identify the union case and its fields for an object | |
val GetUnionFields : value:obj * unionType:Type * ?allowAccessToPrivateRepresentation:bool -> Reflection.UnionCaseInfo * obj [] | |
/// Assumes the given type is a union type. | |
/// If not, ArgumentException is raised during pre-computation. | |
val PreComputeUnionTagReader : unionType:Type * ?allowAccessToPrivateRepresentation:bool -> obj -> int | |
/// Precompute a property or static method for reading an integer representing the case tag of a union type. | |
val PreComputeUnionTagMemberInfo : unionType:Type * ?allowAccessToPrivateRepresentation:bool -> Reflection.MemberInfo | |
/// Precomputes a function for reading all the fields for a particular discriminator case of a union type | |
val PreComputeUnionReader : unionCase:Reflection.UnionCaseInfo * ?allowAccessToPrivateRepresentation:bool -> obj -> obj [] | |
/// Precomputes a function for constructing a discriminated union value for a particular union case. | |
val PreComputeUnionConstructor : unionCase:Reflection.UnionCaseInfo * ?allowAccessToPrivateRepresentation:bool -> obj [] -> obj | |
/// A method that constructs objects of the given case | |
val PreComputeUnionConstructorInfo : unionCase:Reflection.UnionCaseInfo * ?allowAccessToPrivateRepresentation:bool -> Reflection.MethodInfo | |
/// Reads all the fields from a value built using an instance of an F# exception declaration | |
val GetExceptionFields : exn:obj * ?allowAccessToPrivateRepresentation:bool -> obj [] | |
/// Reads all the fields from a record value, in declaration order | |
val GetRecordFields : recordType:Type * ?allowAccessToPrivateRepresentation:bool -> Reflection.PropertyInfo [] | |
/// Gets the cases of a union type. | |
val GetUnionCases : unionType:Type * ?allowAccessToPrivateRepresentation:bool -> Reflection.UnionCaseInfo [] | |
/// Return true if the typ is a representation of an F# record type | |
val IsRecord : typ:Type * ?allowAccessToPrivateRepresentation:bool -> bool | |
/// Returns true if the typ is a representation of an F# union type or the runtime type of a value of that type | |
val IsUnion : typ:Type * ?allowAccessToPrivateRepresentation:bool -> bool | |
/// Reads all the fields from an F# exception declaration, in declaration order | |
val GetExceptionFields : exceptionType:Type * ?allowAccessToPrivateRepresentation:bool -> Reflection.PropertyInfo [] | |
/// Returns true if the typ is a representation of an F# exception declaration | |
val IsExceptionRepresentation : exceptionType:Type * ?allowAccessToPrivateRepresentation:bool -> bool |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Contains a set of derived F# active patterns to analyze F# expression objects | |
[<CompilationRepresentation(enum<CompilationRepresentationFlags> (4))>] | |
module Microsoft.FSharp.Quotations.DerivedPatterns | |
/// An active pattern to recognize constant decimal expressions | |
val (|Decimal|_|) : input:Quotations.Expr -> decimal option | |
namespace Microsoft.FSharp.Core | |
/// Five dimensional arrays, typically zero-based. Non-zero-based arrays | |
/// can be created using methods on the System.Array type. | |
[<Class>] | |
type ``[,,,,]``<'T> = | |
namespace Microsoft.FSharp.Core | |
/// Six dimensional arrays, typically zero-based. Non-zero-based arrays | |
/// can be created using methods on the System.Array type. | |
[<Class>] | |
type ``[,,,,,]``<'T> = | |
namespace Microsoft.FSharp.Core | |
/// Seven dimensional arrays, typically zero-based. Non-zero-based arrays | |
/// can be created using methods on the System.Array type. | |
[<Class>] | |
type ``[,,,,,,]``<'T> = | |
namespace Microsoft.FSharp.Core | |
/// Eight dimensional arrays, typically zero-based. Non-zero-based arrays | |
/// can be created using methods on the System.Array type. | |
[<Class>] | |
type ``[,,,,,,,]``<'T> = | |
namespace Microsoft.FSharp.Core | |
/// Nine dimensional arrays, typically zero-based. Non-zero-based arrays | |
/// can be created using methods on the System.Array type. | |
[<Class>] | |
type ``[,,,,,,,,]``<'T> = | |
namespace Microsoft.FSharp.Core | |
/// Ten dimensional arrays, typically zero-based. Non-zero-based arrays | |
/// can be created using methods on the System.Array type. | |
[<Class>] | |
type ``[,,,,,,,,,]``<'T> = | |
namespace Microsoft.FSharp.Core | |
/// Eleven dimensional arrays, typically zero-based. Non-zero-based arrays | |
/// can be created using methods on the System.Array type. | |
[<Class>] | |
type ``[,,,,,,,,,,]``<'T> = | |
namespace Microsoft.FSharp.Core | |
/// Twelve dimensional arrays, typically zero-based. Non-zero-based arrays | |
/// can be created using methods on the System.Array type. | |
[<Class>] | |
type ``[,,,,,,,,,,,]``<'T> = | |
namespace Microsoft.FSharp.Core | |
/// Thirteen dimensional arrays, typically zero-based. Non-zero-based arrays | |
/// can be created using methods on the System.Array type. | |
[<Class>] | |
type ``[,,,,,,,,,,,,]``<'T> = | |
namespace Microsoft.FSharp.Core | |
/// Fourteen dimensional arrays, typically zero-based. Non-zero-based arrays | |
/// can be created using methods on the System.Array type. | |
[<Class>] | |
type ``[,,,,,,,,,,,,,]``<'T> = | |
namespace Microsoft.FSharp.Core | |
/// Fifteen dimensional arrays, typically zero-based. Non-zero-based arrays | |
/// can be created using methods on the System.Array type. | |
[<Class>] | |
type ``[,,,,,,,,,,,,,,]``<'T> = | |
namespace Microsoft.FSharp.Core | |
/// Sixteen dimensional arrays, typically zero-based. Non-zero-based arrays | |
/// can be created using methods on the System.Array type. | |
[<Class>] | |
type ``[,,,,,,,,,,,,,,,]``<'T> = | |
namespace Microsoft.FSharp.Core | |
/// Seventeen dimensional arrays, typically zero-based. Non-zero-based arrays | |
/// can be created using methods on the System.Array type. | |
[<Class>] | |
type ``[,,,,,,,,,,,,,,,,]``<'T> = | |
namespace Microsoft.FSharp.Core | |
/// Eighteen dimensional arrays, typically zero-based. Non-zero-based arrays | |
/// can be created using methods on the System.Array type. | |
[<Class>] | |
type ``[,,,,,,,,,,,,,,,,,]``<'T> = | |
namespace Microsoft.FSharp.Core | |
/// Nineteen dimensional arrays, typically zero-based. Non-zero-based arrays | |
/// can be created using methods on the System.Array type. | |
[<Class>] | |
type ``[,,,,,,,,,,,,,,,,,,]``<'T> = | |
namespace Microsoft.FSharp.Core | |
/// Twenty dimensional arrays, typically zero-based. Non-zero-based arrays | |
/// can be created using methods on the System.Array type. | |
[<Class>] | |
type ``[,,,,,,,,,,,,,,,,,,,]``<'T> = | |
namespace Microsoft.FSharp.Core | |
/// Twenty-one dimensional arrays, typically zero-based. Non-zero-based arrays | |
/// can be created using methods on the System.Array type. | |
[<Class>] | |
type ``[,,,,,,,,,,,,,,,,,,,,]``<'T> = | |
namespace Microsoft.FSharp.Core | |
/// Twenty-two dimensional arrays, typically zero-based. Non-zero-based arrays | |
/// can be created using methods on the System.Array type. | |
[<Class>] | |
type ``[,,,,,,,,,,,,,,,,,,,,,]``<'T> = | |
namespace Microsoft.FSharp.Core | |
/// Twenty-three dimensional arrays, typically zero-based. Non-zero-based arrays | |
/// can be created using methods on the System.Array type. | |
[<Class>] | |
type ``[,,,,,,,,,,,,,,,,,,,,,,]``<'T> = | |
namespace Microsoft.FSharp.Core | |
/// Twenty-four dimensional arrays, typically zero-based. Non-zero-based arrays | |
/// can be created using methods on the System.Array type. | |
[<Class>] | |
type ``[,,,,,,,,,,,,,,,,,,,,,,,]``<'T> = | |
namespace Microsoft.FSharp.Core | |
/// Twenty-five dimensional arrays, typically zero-based. Non-zero-based arrays | |
/// can be created using methods on the System.Array type. | |
[<Class>] | |
type ``[,,,,,,,,,,,,,,,,,,,,,,,,]``<'T> = | |
namespace Microsoft.FSharp.Core | |
/// Twenty-six dimensional arrays, typically zero-based. Non-zero-based arrays | |
/// can be created using methods on the System.Array type. | |
[<Class>] | |
type ``[,,,,,,,,,,,,,,,,,,,,,,,,,]``<'T> = | |
namespace Microsoft.FSharp.Core | |
/// Twenty-seven dimensional arrays, typically zero-based. Non-zero-based arrays | |
/// can be created using methods on the System.Array type. | |
[<Class>] | |
type ``[,,,,,,,,,,,,,,,,,,,,,,,,,,]``<'T> = | |
namespace Microsoft.FSharp.Core | |
/// Twenty-eight dimensional arrays, typically zero-based. Non-zero-based arrays | |
/// can be created using methods on the System.Array type. | |
[<Class>] | |
type ``[,,,,,,,,,,,,,,,,,,,,,,,,,,,]``<'T> = | |
namespace Microsoft.FSharp.Core | |
/// Twenty-nine dimensional arrays, typically zero-based. Non-zero-based arrays | |
/// can be created using methods on the System.Array type. | |
[<Class>] | |
type ``[,,,,,,,,,,,,,,,,,,,,,,,,,,,,]``<'T> = | |
namespace Microsoft.FSharp.Core | |
/// Thirty dimensional arrays, typically zero-based. Non-zero-based arrays | |
/// can be created using methods on the System.Array type. | |
[<Class>] | |
type ``[,,,,,,,,,,,,,,,,,,,,,,,,,,,,,]``<'T> = | |
namespace Microsoft.FSharp.Core | |
/// Thirty-one dimensional arrays, typically zero-based. Non-zero-based arrays | |
/// can be created using methods on the System.Array type. | |
[<Class>] | |
type ``[,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,]``<'T> = | |
namespace Microsoft.FSharp.Core | |
/// Thirty-two dimensional arrays, typically zero-based. Non-zero-based arrays | |
/// can be created using methods on the System.Array type. | |
[<Class>] | |
type ``[,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,]``<'T> = | |
/// 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. | |
[<CompilationRepresentation(enum<CompilationRepresentationFlags> (4))>] | |
[<RequireQualifiedAccess>] | |
module Microsoft.FSharp.Core.String | |
/// Builds a new string containing only the characters of the input string | |
/// for which the given predicate returns "true". | |
val filter : predicate:(char -> bool) -> str:string -> string | |
/// Basic operations on options. | |
[<CompilationRepresentation(enum<CompilationRepresentationFlags> (4))>] | |
module Microsoft.FSharp.Core.Option | |
/// filter f inp evaluates to match inp with None -> None | Some x -> if f x then Some x else None. | |
val filter : predicate:('T -> bool) -> option:'T option -> 'T option | |
/// Convert the option to a Nullable value. | |
val toNullable : option:'T option -> Nullable<'T> when 'T : (new : unit -> 'T) and 'T : struct and 'T :> ValueType | |
/// Convert a Nullable value to an option. | |
val ofNullable : value:Nullable<'T> -> 'T option when 'T : (new : unit -> 'T) and 'T : struct and 'T :> ValueType | |
/// Convert a potentially null value to an option. | |
val ofObj : value:'T -> 'T option when 'T : null | |
/// Convert an option to a potentially null value. | |
val toObj : value:'T option -> 'T when 'T : null | |
/// Basic F# Operators. This module is automatically opened in all F# code. | |
[<AutoOpen>] | |
module Microsoft.FSharp.Core.Operators | |
/// Try to unbox a strongly typed value. | |
val inline tryUnbox : value:obj -> 'T option | |
/// Determines whether the given value is null. | |
val inline isNull : value:'T -> bool when 'T : null | |
/// Language primitives associated with the F# language | |
module Microsoft.FSharp.Core.LanguagePrimitives | |
/// Make an F# hash/equality object for the given type | |
val FastGenericEqualityComparerFromTable : Collections.Generic.IEqualityComparer<'T> when 'T : equality | |
/// Make an F# comparer object for the given type | |
val FastGenericComparerFromTable : Collections.Generic.IComparer<'T> when 'T : comparison | |
namespace Microsoft.FSharp.Core.CompilerServices | |
/// Represents additional, optional information for a type provider component | |
[<Interface>] | |
type ITypeProvider2 = | |
/// Apply static arguments to a provided method that accepts static arguments. | |
abstract member ApplyStaticArgumentsForMethod : methodWithoutArguments:Reflection.MethodBase * methodNameWithArguments:string * staticArguments:obj [] -> Reflection.MethodBase | |
/// Get the static parameters for a provided method. | |
abstract member GetStaticParametersForMethod : methodWithoutArguments:Reflection.MethodBase -> Reflection.ParameterInfo [] | |
namespace Microsoft.FSharp.Core | |
/// 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. | |
[<Sealed>] | |
type AllowNullLiteralAttribute = | |
inherit System.Attribute | |
/// Creates an instance of the attribute with the specified value | |
new : value:bool -> AllowNullLiteralAttribute | |
/// The value of the attribute, indicating whether the type allows the null literal or not | |
member Value : bool | |
/// A module of extension members providing asynchronous operations for some basic Web operations. | |
[<AutoOpen>] | |
module Microsoft.FSharp.Control.WebExtensions | |
/// Returns an asynchronous computation that, when run, will wait for the download of the given URI. | |
val AsyncDownloadData : address:Uri -> Async<byte []> | |
/// Returns an asynchronous computation that, when run, will wait for the download of the given URI to specified file. | |
val AsyncDownloadFile : address:Uri * fileName:string -> Async<unit> | |
namespace Microsoft.FSharp.Control | |
/// This static class holds members for creating and manipulating asynchronous computations. | |
[<Sealed>] | |
[<CompiledName("FSharpAsync")>] | |
[<Class>] | |
type Async = | |
/// Return an asynchronous computation that will wait for the given task to complete and return | |
/// its result. | |
static member AwaitTask : task:Threading.Tasks.Task -> Async<unit> | |
/// Basic operations on IEnumerables. | |
[<RequireQualifiedAccess>] | |
[<CompilationRepresentation(enum<CompilationRepresentationFlags> (4))>] | |
module Microsoft.FSharp.Collections.Seq | |
/// Tests if the sequence contains the specified element. | |
val inline contains : value:'T -> source:seq<'T> -> bool when 'T : equality | |
/// Returns the last element for which the given function returns true. | |
val findBack : predicate:('T -> bool) -> source:seq<'T> -> 'T | |
/// Returns the index of the last element for which the given function returns true. | |
val findIndexBack : predicate:('T -> bool) -> source:seq<'T> -> int | |
/// Applies a function to corresponding elements of two collections, threading an accumulator argument | |
/// through the computation. The two sequences need not have equal lengths: | |
/// when one sequence is exhausted any remaining elements in the other sequence are ignored. | |
/// If the input function is f and the elements are i0...iN and j0...jN | |
/// then computes f (... (f s i0 j0)...) iN jN. | |
val fold2 : folder:('State -> 'T1 -> 'T2 -> 'State) -> state:'State -> source1:seq<'T1> -> source2:seq<'T2> -> 'State | |
/// Applies a function to each element of the collection, starting from the end, threading an accumulator argument | |
/// through the computation. If the input function is f and the elements are i0...iN | |
/// then computes f i0 (... (f iN s)...) | |
val foldBack : folder:('T -> 'State -> 'State) -> source:seq<'T> -> state:'State -> 'State | |
/// Applies a function to corresponding elements of two collections, starting from the end of the shorter collection, | |
/// threading an accumulator argument through the computation. The two sequences need not have equal lengths. | |
/// If the input function is f and the elements are i0...iN and j0...jM, N < M | |
/// then computes f i0 j0 (... (f iN jN s)...). | |
val foldBack2 : folder:('T1 -> 'T2 -> 'State -> 'State) -> source1:seq<'T1> -> source2:seq<'T2> -> state:'State -> 'State | |
/// Returns the first element of the sequence, or None if the sequence is empty. | |
val tryHead : source:seq<'T> -> 'T option | |
/// Returns the last element of the sequence. | |
/// Return None if no such element exists. | |
val tryLast : source:seq<'T> -> 'T option | |
/// Builds a new collection whose elements are the corresponding elements of the input collection | |
/// paired with the integer index (from 0) of each element. | |
val indexed : source:seq<'T> -> seq<int * 'T> | |
/// Computes the element at the specified index in the collection. | |
val item : index:int -> source:seq<'T> -> 'T | |
/// Applies the given function to two collections simultaneously. If one sequence is shorter than | |
/// the other then the remaining elements of the longer sequence are ignored. The integer passed to the | |
/// function indicates the index of element. | |
val iteri2 : action:(int -> 'T1 -> 'T2 -> unit) -> source1:seq<'T1> -> source2:seq<'T2> -> unit | |
/// Combines map and fold. Builds a new collection whose elements are the results of applying the given function | |
/// to each of the elements of the collection. The function is also used to accumulate a final value. | |
val mapFold : mapping:('State -> 'T -> 'Result * 'State) -> state:'State -> source:seq<'T> -> seq<'Result> * 'State | |
/// Combines map and foldBack. Builds a new collection whose elements are the results of applying the given function | |
/// to each of the elements of the collection. The function is also used to accumulate a final value. | |
val mapFoldBack : mapping:('T -> 'State -> 'Result * 'State) -> source:seq<'T> -> state:'State -> seq<'Result> * 'State | |
/// Builds a new collection whose elements are the results of applying the given function | |
/// to the corresponding triples of elements from the three sequences. If one input sequence if shorter than | |
/// the others then the remaining elements of the longer sequences are ignored. | |
val map3 : mapping:('T1 -> 'T2 -> 'T3 -> 'U) -> source1:seq<'T1> -> source2:seq<'T2> -> source3:seq<'T3> -> seq<'U> | |
/// Builds a new collection whose elements are the results of applying the given function | |
/// to the corresponding pairs of elements from the two sequences. If one input sequence is shorter than | |
/// the other then the remaining elements of the longer sequence are ignored. The integer index passed to the | |
/// function indicates the index (from 0) of element being transformed. | |
val mapi2 : mapping:(int -> 'T1 -> 'T2 -> 'U) -> source1:seq<'T1> -> source2:seq<'T2> -> seq<'U> | |
/// Returns a sequence with all elements permuted according to the | |
/// specified permutation. | |
val permute : indexMap:(int -> int) -> source:seq<'T> -> seq<'T> | |
/// Creates a sequence by replicating the given initial value. | |
val replicate : count:int -> initial:'T -> seq<'T> | |
/// Applies a function to each element of the sequence, starting from the end, threading an accumulator argument | |
/// through the computation. If the input function is f and the elements are i0...iN | |
/// then computes f i0 (...(f iN-1 iN)). | |
val reduceBack : reduction:('T -> 'T -> 'T) -> source:seq<'T> -> 'T | |
/// Returns a new sequence with the elements in reverse order. | |
val rev : source:seq<'T> -> seq<'T> | |
/// Like foldBack, but returns the sequence of intermediary and final results. | |
val scanBack : folder:('T -> 'State -> 'State) -> source:seq<'T> -> state:'State -> seq<'State> | |
/// Yields a sequence ordered using the given comparison function. | |
val sortWith : comparer:('T -> 'T -> int) -> source:seq<'T> -> seq<'T> | |
/// Yields a sequence ordered descending by keys. | |
val inline sortDescending : source:seq<'T> -> seq<'T> when 'T : comparison | |
/// Applies a key-generating function to each element of a sequence and yield a sequence ordered | |
/// descending by keys. The keys are compared using generic comparison as implemented by Operators.compare. | |
val inline sortByDescending : projection:('T -> 'Key) -> source:seq<'T> -> seq<'T> when 'Key : comparison | |
/// Returns a sequence that skips 1 element of the underlying sequence and then yields the | |
/// remaining elements of the sequence. | |
val tail : source:seq<'T> -> seq<'T> | |
/// Returns the last element for which the given function returns true. | |
/// Return None if no such element exists. | |
val tryFindBack : predicate:('T -> bool) -> source:seq<'T> -> 'T option | |
/// Tries to find the nth element in the sequence. | |
/// Returns None if index is negative or the input sequence does not contain enough elements. | |
val tryItem : index:int -> source:seq<'T> -> 'T option | |
/// Returns the index of the last element in the sequence | |
/// that satisfies the given predicate. Return None if no such element exists. | |
val tryFindIndexBack : predicate:('T -> bool) -> source:seq<'T> -> int option | |
namespace Microsoft.FSharp.Collections | |
/// The type of immutable singly-linked lists. | |
[<DefaultAugmentation(false)>] | |
[<StructuralEquality>] | |
[<StructuralComparison>] | |
[<CompiledName("FSharpList`1")>] | |
type List<'T> = | |
| ( [] )blank in writeUnionCase | |
| ( :: ) of Head: 'T * Tail: 'T listblank in writeUnionCase | |
interface System.Collections.IEnumerable | |
interface System.Collections.Generic.IEnumerable<'T> | |
/// Gets a slice of the list, the elements of the list from the given start index to the given end index. | |
member GetSlice : startIndex:int option * endIndex:int option -> 'T list | |
/// Basic operations on lists. | |
[<CompilationRepresentation(enum<CompilationRepresentationFlags> (4))>] | |
[<RequireQualifiedAccess>] | |
module Microsoft.FSharp.Collections.List | |
/// Compares two lists using the given comparison function, element by element. | |
/// Returns the first non-zero result from the comparison function. If the end of a list | |
/// is reached it returns a -1 if the first list is shorter and a 1 if the second list | |
/// is shorter. | |
val inline compareWith : comparer:('T -> 'T -> int) -> list1:'T list -> list2:'T list -> int | |
/// Tests if the list contains the specified element. | |
val inline contains : value:'T -> source:'T list -> bool when 'T : equality | |
/// Returns a list that contains no duplicate entries according to generic hash and | |
/// equality comparisons on the entries. | |
/// If an element occurs multiple times in the list then the later occurrences are discarded. | |
val distinct : list:'T list -> 'T list when 'T : equality | |
/// Returns a list that contains no duplicate entries according to the | |
/// generic hash and equality comparisons on the keys returned by the given key-generating function. | |
/// If an element occurs multiple times in the list then the later occurrences are discarded. | |
val distinctBy : projection:('T -> 'Key) -> list:'T list -> 'T list when 'Key : equality | |
/// Applies a key-generating function to each element of a list and returns a list yielding unique | |
/// keys and their number of occurrences in the original list. | |
val countBy : projection:('T -> 'Key) -> list:'T list -> ('Key * int) list when 'Key : equality | |
/// Returns the only element of the list. | |
val exactlyOne : list:'T list -> 'T | |
/// Returns the last element for which the given function returns true. | |
/// Raises KeyNotFoundException if no such element exists. | |
val findBack : predicate:('T -> bool) -> list:'T list -> 'T | |
/// Returns the index of the last element in the list | |
/// that satisfies the given predicate. | |
/// Raises KeyNotFoundException if no such element exists. | |
val findIndexBack : predicate:('T -> bool) -> list:'T list -> int | |
/// Applies a key-generating function to each element of a list and yields a list of | |
/// unique keys. Each unique key contains a list of all elements that match | |
/// to this key. | |
val groupBy : projection:('T -> 'Key) -> list:'T list -> ('Key * 'T list) list when 'Key : equality | |
/// Returns a new list whose elements are the corresponding elements | |
/// of the input list paired with the index (from 0) of each element. | |
val indexed : list:'T list -> (int * 'T) list | |
/// Indexes into the list. The first element has index 0. | |
val item : index:int -> list:'T list -> 'T | |
/// Returns the last element of the list. | |
val last : list:'T list -> 'T | |
/// Returns the last element of the list. | |
/// Return None if no such element exists. | |
val tryLast : list:'T list -> 'T option | |
/// Combines map and fold. Builds a new list whose elements are the results of applying the given function | |
/// to each of the elements of the input list. The function is also used to accumulate a final value. | |
val mapFold : mapping:('State -> 'T -> 'Result * 'State) -> state:'State -> list:'T list -> 'Result list * 'State | |
/// Combines map and foldBack. Builds a new list whose elements are the results of applying the given function | |
/// to each of the elements of the input list. The function is also used to accumulate a final value. | |
val mapFoldBack : mapping:('T -> 'State -> 'Result * 'State) -> list:'T list -> state:'State -> 'Result list * 'State | |
/// Returns a list of each element in the input list and its predecessor, with the | |
/// exception of the first element which is only returned as the predecessor of the second element. | |
val pairwise : list:'T list -> ('T * 'T) list | |
/// Returns a list that contains one item only. | |
val inline singleton : value:'T -> 'T list | |
/// Returns the list after removing the first N elements. | |
val skip : count:int -> list:'T list -> 'T list | |
/// Bypasses elements in a list while the given predicate returns true, and then returns | |
/// the remaining elements of the list. | |
val skipWhile : predicate:('T -> bool) -> list:'T list -> 'T list | |
/// Splits a list into two lists, at the given index. | |
val splitAt : index:int -> list:'T list -> 'T list * 'T list | |
/// Sorts the given list in descending order using keys given by the given projection. Keys are compared using Operators.compare. | |
val inline sortByDescending : projection:('T -> 'Key) -> list:'T list -> 'T list when 'Key : comparison | |
/// Sorts the given list in descending order using Operators.compare. | |
val inline sortDescending : list:'T list -> 'T list when 'T : comparison | |
/// Returns the first N elements of the list. | |
val take : count:int -> list:'T list -> 'T list | |
/// Returns a list that contains all elements of the original list while the | |
/// given predicate returns true, and then returns no further elements. | |
val takeWhile : predicate:('T -> bool) -> list:'T list -> 'T list | |
/// Returns the first element of the list, or | |
/// None if the list is empty. | |
val tryHead : list:'T list -> 'T option | |
/// Returns at most N elements in a new list. | |
val truncate : count:int -> list:'T list -> 'T list | |
/// Returns the last element for which the given function returns true.. | |
/// Return None if no such element exists. | |
val tryFindBack : predicate:('T -> bool) -> list:'T list -> 'T option | |
/// Tries to find the nth element in the list. | |
/// Returns None if index is negative or the list does not contain enough elements. | |
val tryItem : index:int -> list:'T list -> 'T option | |
/// Returns the index of the last element in the list | |
/// that satisfies the given predicate. | |
/// Return None if no such element exists. | |
val tryFindIndexBack : predicate:('T -> bool) -> list:'T list -> int option | |
/// Returns a list that contains the elements generated by the given computation. | |
/// The given initial state argument is passed to the element generator. | |
val unfold : generator:('State -> ('T * 'State) option) -> state:'State -> 'T list | |
/// Returns a new list containing only the elements of the list | |
/// for which the given predicate returns "true" | |
val where : predicate:('T -> bool) -> list:'T list -> 'T list | |
/// Returns a list of sliding windows containing elements drawn from the input | |
/// list. Each window is returned as a fresh array. | |
val windowed : windowSize:int -> list:'T list -> 'T [] list | |
/// Common notions of value identity used with hash tables. | |
module Microsoft.FSharp.Collections.HashIdentity | |
/// Non-structural hashing. Equality using NonStructuralComparison.(=) and NonStructuralComparison.hash. | |
val NonStructural : Collections.Generic.IEqualityComparer< ^T> when ^T : equality and ^T : (static member ( = ) : ^T * ^T -> bool) | |
/// Common notions of comparison identity used with sorted data structures. | |
module Microsoft.FSharp.Collections.ComparisonIdentity | |
/// Non-structural comparison. Compare using NonStructuralComparison.compare. | |
val NonStructural : Collections.Generic.IComparer< ^T> when ^T : (static member ( < ) : ^T * ^T -> bool) and ^T : (static member ( > ) : ^T * ^T -> bool) | |
/// Basic operations on arrays. | |
[<CompilationRepresentation(enum<CompilationRepresentationFlags> (4))>] | |
[<RequireQualifiedAccess>] | |
module Microsoft.FSharp.Collections.Array | |
/// Compares two arrays using the given comparison function, element by element. | |
/// Returns the first non-zero result from the comparison function. If the end of an array | |
/// is reached it returns a -1 if the first array is shorter and a 1 if the second array | |
/// is shorter. | |
val inline compareWith : comparer:('T -> 'T -> int) -> array1:'T [] -> array2:'T [] -> int | |
/// Tests if the array contains the specified element. | |
val inline contains : value:'T -> array:'T [] -> bool when 'T : equality | |
/// Applies a key-generating function to each element of an array and returns an array yielding unique | |
/// keys and their number of occurrences in the original array. | |
val countBy : projection:('T -> 'Key) -> array:'T [] -> ('Key * int) [] when 'Key : equality | |
/// Returns the first element of the array, or | |
/// None if the array is empty. | |
val tryHead : array:'T [] -> 'T option | |
/// Returns an array that contains no duplicate entries according to generic hash and | |
/// equality comparisons on the entries. | |
/// If an element occurs multiple times in the array then the later occurrences are discarded. | |
val distinct : array:'T [] -> 'T [] when 'T : equality | |
/// Returns an array that contains no duplicate entries according to the | |
/// generic hash and equality comparisons on the keys returned by the given key-generating function. | |
/// If an element occurs multiple times in the array then the later occurrences are discarded. | |
val distinctBy : projection:('T -> 'Key) -> array:'T [] -> 'T [] when 'Key : equality | |
/// Returns the only element of the array. | |
val exactlyOne : array:'T [] -> 'T | |
/// Returns the last element for which the given function returns 'true'. | |
/// Raise KeyNotFoundException if no such element exists. | |
val findBack : predicate:('T -> bool) -> array:'T [] -> 'T | |
/// Returns the index of the last element in the array | |
/// that satisfies the given predicate. Raise KeyNotFoundException if | |
/// none of the elements satisfy the predicate. | |
val findIndexBack : predicate:('T -> bool) -> array:'T [] -> int | |
/// Returns the first element of the array. | |
val head : array:'T [] -> 'T | |
/// Applies a key-generating function to each element of an array and yields an array of | |
/// unique keys. Each unique key contains an array of all elements that match | |
/// to this key. | |
val groupBy : projection:('T -> 'Key) -> array:'T [] -> ('Key * 'T []) [] when 'Key : equality | |
/// Builds a new array whose elements are the corresponding elements of the input array | |
/// paired with the integer index (from 0) of each element. | |
val indexed : array:'T [] -> (int * 'T) [] | |
/// Returns the last element of the array. | |
val inline last : array:'T [] -> 'T | |
/// Gets an element from an array. | |
val item : index:int -> array:'T [] -> 'T | |
/// Returns the last element of the array. | |
/// Return None if no such element exists. | |
val tryLast : array:'T [] -> 'T option | |
/// Combines map and fold. Builds a new array whose elements are the results of applying the given function | |
/// to each of the elements of the input array. The function is also used to accumulate a final value. | |
val mapFold : mapping:('State -> 'T -> 'Result * 'State) -> state:'State -> array:'T [] -> 'Result [] * 'State | |
/// Combines map and foldBack. Builds a new array whose elements are the results of applying the given function | |
/// to each of the elements of the input array. The function is also used to accumulate a final value. | |
val mapFoldBack : mapping:('T -> 'State -> 'Result * 'State) -> array:'T [] -> state:'State -> 'Result [] * 'State | |
/// Builds a new collection whose elements are the results of applying the given function | |
/// to the corresponding triples from the three collections. The three input | |
/// arrays must have the same length, otherwise an ArgumentException is | |
/// raised. | |
val map3 : mapping:('T1 -> 'T2 -> 'T3 -> 'U) -> array1:'T1 [] -> array2:'T2 [] -> array3:'T3 [] -> 'U [] | |
/// Returns an array of each element in the input array and its predecessor, with the | |
/// exception of the first element which is only returned as the predecessor of the second element. | |
val pairwise : array:'T [] -> ('T * 'T) [] | |
/// Creates an array by replicating the given initial value. | |
val replicate : count:int -> initial:'T -> 'T [] | |
/// Returns an array that contains one item only. | |
val inline singleton : value:'T -> 'T [] | |
/// Builds a new array that contains the elements of the given array, excluding the first N elements. | |
val skip : count:int -> array:'T [] -> 'T [] | |
/// Bypasses elements in an array while the given predicate returns true, and then returns | |
/// the remaining elements in a new array. | |
val skipWhile : predicate:('T -> bool) -> array:'T [] -> 'T [] | |
/// Splits an array into two arrays, at the given index. | |
val splitAt : index:int -> array:'T [] -> 'T [] * 'T [] | |
/// Sorts the elements of an array, in descending order, returning a new array. Elements are compared using Operators.compare. | |
val inline sortDescending : array:'T [] -> 'T [] when 'T : comparison | |
/// Sorts the elements of an array, in descending order, using the given projection for the keys and returning a new array. | |
/// Elements are compared using Operators.compare. | |
val inline sortByDescending : projection:('T -> 'Key) -> array:'T [] -> 'T [] when 'Key : comparison | |
/// Returns the first N elements of the array. | |
val take : count:int -> array:'T [] -> 'T [] | |
/// Returns an array that contains all elements of the original array while the | |
/// given predicate returns true, and then returns no further elements. | |
val takeWhile : predicate:('T -> bool) -> array:'T [] -> 'T [] | |
/// Returns a new array containing the elements of the original except the first element. | |
val tail : array:'T [] -> 'T [] | |
/// Returns at most N elements in a new array. | |
val truncate : count:int -> array:'T [] -> 'T [] | |
/// Returns the last element for which the given function returns true. | |
/// Return None if no such element exists. | |
val tryFindBack : predicate:('T -> bool) -> array:'T [] -> 'T option | |
/// Tries to find the nth element in the array. | |
/// Returns None if index is negative or the input array does not contain enough elements. | |
val tryItem : index:int -> array:'T [] -> 'T option | |
/// Returns the index of the last element in the array | |
/// that satisfies the given predicate. | |
val tryFindIndexBack : predicate:('T -> bool) -> array:'T [] -> int option | |
/// Returns an array that contains the elements generated by the given computation. | |
/// The given initial state argument is passed to the element generator. | |
val unfold : generator:('State -> ('T * 'State) option) -> state:'State -> 'T [] | |
/// Returns a new array containing only the elements of the array | |
/// for which the given predicate returns "true". | |
val where : predicate:('T -> bool) -> array:'T [] -> 'T [] | |
/// Returns an array of sliding windows containing elements drawn from the input | |
/// array. Each window is returned as a fresh array. | |
val windowed : windowSize:int -> array:'T [] -> 'T [] ][ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#r "System.Xml.Linq" | |
#r @"..\packages\FSharp.Compiler.Service\lib\net45\FSharp.Compiler.Service.dll" | |
#r @"..\src\FSharpVSPowerTools.Core\bin\Release\FSharpVSPowerTools.Core.dll" | |
open System | |
open System.IO | |
open System.Collections.Generic | |
open System.Text | |
open System.Xml.Linq | |
open Microsoft.FSharp.Compiler.AbstractIL.Internal.Library | |
open Microsoft.FSharp.Compiler.SourceCodeServices | |
open FSharpVSPowerTools.CodeGeneration | |
// http://fsharp.github.io/FSharp.Compiler.Service/filesystem.html | |
let defaultFileSystem = Shim.FileSystem | |
let fileName1 = @"c:\mycode\test1.fs" // note, the path doesn't exist | |
type MyFileSystem() = | |
// https://github.com/fsharp/FSharp.Compiler.Service/pull/287 | |
// let dfs = DefaultFileSystem() :> IFileSystem | |
let dfs = defaultFileSystem | |
let file1 = """ | |
open System | |
let a = 1 | |
""" | |
let files = dict [(fileName1, file1)] | |
interface IFileSystem with | |
member __.FileStreamReadShim(fileName) = | |
match files.TryGetValue(fileName) with | |
| true, text -> new MemoryStream(Encoding.UTF8.GetBytes(text)) :> Stream | |
| _ -> dfs.FileStreamReadShim(fileName) | |
member __.FileStreamCreateShim(fileName) = | |
dfs.FileStreamCreateShim(fileName) | |
member __.FileStreamWriteExistingShim(fileName) = | |
dfs.FileStreamWriteExistingShim(fileName) | |
member __.ReadAllBytesShim(fileName) = | |
match files.TryGetValue(fileName) with | |
| true, text -> Encoding.UTF8.GetBytes(text) | |
| _ -> dfs.ReadAllBytesShim(fileName) | |
member __.GetTempPathShim() = | |
dfs.GetTempPathShim() | |
member __.GetLastWriteTimeShim(fileName) = | |
dfs.GetLastWriteTimeShim(fileName) | |
member __.GetFullPathShim(fileName) = | |
dfs.GetFullPathShim(fileName) | |
member __.IsInvalidPathShim(fileName) = | |
dfs.IsInvalidPathShim(fileName) | |
member __.IsPathRootedShim(fileName) = | |
dfs.IsPathRootedShim(fileName) | |
member __.SafeExists(fileName) = | |
files.ContainsKey(fileName) || dfs.SafeExists(fileName) | |
member __.FileDelete(fileName) = | |
dfs.FileDelete(fileName) | |
member __.AssemblyLoadFrom(fileName) = | |
dfs.AssemblyLoadFrom fileName | |
member __.AssemblyLoad(assemblyName) = | |
dfs.AssemblyLoad assemblyName | |
Shim.FileSystem <- MyFileSystem() | |
let checker = FSharpChecker.Create() | |
// C:\Program Files (x86) | |
let programFiles86 = Environment.GetFolderPath Environment.SpecialFolder.ProgramFilesX86 | |
// C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0 | |
let net40 = programFiles86 + @"\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0" | |
let loadFSharpCoreAssembly path = | |
let projectOptions = | |
let allFlags = | |
[| yield "--simpleresolution"; | |
yield "--noframework"; | |
yield "--debug:full"; | |
yield "--define:DEBUG"; | |
yield "--optimize-"; | |
yield "--doc:test.xml"; | |
yield "--warn:3"; | |
yield "--fullpaths"; | |
yield "--flaterrors"; | |
yield "--target:library"; | |
let references = | |
[ net40 + @"\mscorlib.dll" | |
net40 + @"\System.dll" | |
net40 + @"\System.Core.dll" | |
net40 + @"\System.Numerics.dll" | |
path | |
] | |
for r in references do | |
yield "-r:" + r |] | |
{ ProjectFileName = @"c:\mycode\compilation.fsproj" // Make a name that is unique in this directory. | |
ProjectFileNames = [| fileName1 |] | |
OtherOptions = allFlags | |
ReferencedProjects = [| |] | |
IsIncompleteTypeCheckEnvironment = false | |
UseScriptResolutionRules = true | |
LoadTime = System.DateTime.Now // Note using 'Now' forces reloading | |
UnresolvedReferences = None } | |
let results = checker.ParseAndCheckProject(projectOptions) |> Async.RunSynchronously | |
let symbolUses = results.GetAllUsesOfAllSymbols() |> Async.RunSynchronously | |
let displayContext = symbolUses.[0].DisplayContext | |
let assemblyRefs = results.ProjectContext.GetReferencedAssemblies() | |
displayContext, assemblyRefs.[1] // FSharp.Core | |
// xml doc code derived from | |
// https://github.com/fsprojects/VisualFSharpPowerTools/blob/ad88c5e35f7dca706eba102cfd6f78981903ee9f/tests/FSharpVSPowerTools.Core.Tests/GoToDefinitionTests.fs#L56 | |
let xmlMemberMap = Dictionary() | |
let addXmlDoc (assemblyFile: string) = | |
let xmlFile = Path.ChangeExtension(assemblyFile, ".xml") | |
let doc = XDocument.Load(xmlFile) | |
if doc <> null then | |
for key, value in | |
[ for e in doc.Descendants(XName.Get "member") do | |
let attr = e.Attribute(XName.Get "name") | |
if attr <> null && not (String.IsNullOrEmpty(attr.Value)) then | |
yield attr.Value, e ] do | |
xmlMemberMap.Add(key, value) | |
let getXmlDocBySignature (signature: SignatureGenerator.XmlDocSig) : SignatureGenerator.XmlDoc = | |
match xmlMemberMap.TryGetValue(signature) with | |
| true, element -> | |
try [ element.Element(XName.Get "summary").Value.Trim() ] with _ -> [] | |
| false, _ -> | |
[] | |
type FSharpEntitySig = | |
{ | |
XmlDocSig: string | |
MembersFunctionsAndValuesSigs: string Set | |
} | |
let formatSymbol displayContext symbol (sg: FSharpEntitySig) = | |
let filterer = { | |
SignatureGenerator.Filterer.NoFilters with | |
MemberOrFunctionOrValueFilter = fun m -> sg.MembersFunctionsAndValuesSigs.Contains m.XmlDocSig | |
ModuleFilter = fun m -> m.XmlDocSig = sg.XmlDocSig | |
} | |
let blankLines = { | |
SignatureGenerator.BlankLines.None with | |
BeforeMemberOrFunctionOrValue = 1 | |
BeforePublicNestedEntities = 0 | |
AfterPublicNestedEntity = 0 | |
BeforeMembersFunctionsAndValues = 0 | |
BeforeTypeHeaderOpenDeclaration = 0 | |
AfterTypeHeader = 0 | |
} | |
SignatureGenerator.formatSymbol getXmlDocBySignature 4 displayContext [] symbol filterer blankLines | |
type FSharpEntity with | |
member x.MembersFunctionsAndValuesSigs = | |
x.MembersFunctionsAndValues | |
|> Seq.filter (fun m -> m.Accessibility.IsPublic) | |
|> Seq.map (fun m -> m.XmlDocSig) | |
|> Set.ofSeq | |
member x.Sig | |
with get() = | |
{ | |
XmlDocSig = x.XmlDocSig | |
MembersFunctionsAndValuesSigs = x.MembersFunctionsAndValuesSigs | |
} | |
let getEntitySigs path = | |
let _, a = loadFSharpCoreAssembly path | |
a.Contents.Entities | |
|> Seq.filter (fun ent -> ent.Accessibility.IsPublic) | |
|> Seq.map (fun ent -> ent.Sig) | |
// C:\Program Files (x86)\Reference Assemblies\Microsoft\FSharp\.NETFramework\v4.0\4.3.0.0\FSharp.Core.dll | |
let fc30 = programFiles86 + @"\Reference Assemblies\Microsoft\FSharp\.NETFramework\v4.0\4.3.0.0\FSharp.Core.dll" | |
let fc31 = programFiles86 + @"\Reference Assemblies\Microsoft\FSharp\.NETFramework\v4.0\4.3.1.0\FSharp.Core.dll" | |
let fc40 = programFiles86 + @"\Reference Assemblies\Microsoft\FSharp\.NETFramework\v4.0\4.4.0.0\FSharp.Core.dll" | |
//let a = fc30 | |
//let b = fc31 | |
let a = fc31 | |
let b = fc40 | |
addXmlDoc b | |
let aSigs = | |
getEntitySigs a | |
|> Seq.map (fun es -> es.XmlDocSig, es) | |
|> Map.ofSeq | |
let dc, bAssembly = loadFSharpCoreAssembly b | |
let printSymbol dc s sg = | |
match formatSymbol dc s sg with | |
| Some txt -> printf "\n\n%s" txt | |
| None -> () | |
bAssembly.Contents.Entities | |
|> Seq.filter (fun ent -> ent.Accessibility.IsPublic) | |
|> Seq.iter (fun bEnt -> | |
if aSigs.ContainsKey bEnt.XmlDocSig then | |
let aSig = aSigs.[bEnt.XmlDocSig] | |
let bSig = bEnt.Sig | |
if aSig <> bSig then | |
let sg = { XmlDocSig = bEnt.XmlDocSig; MembersFunctionsAndValuesSigs = Set.difference bEnt.Sig.MembersFunctionsAndValuesSigs aSig.MembersFunctionsAndValuesSigs } | |
printSymbol dc bEnt sg | |
else | |
printSymbol dc bEnt bEnt.Sig | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment