├── src └── FSharp.Quotations.Evaluator │ ├── paket.references │ ├── Script.fsx │ ├── FSharp.Quotations.Evaluator.fsproj │ ├── Public.fs │ ├── QuotationsEvaluator.fsi │ ├── Tools.fs │ └── QuotationsEvaluator.fs ├── tests └── FSharp.Quotations.Evaluator.Tests │ ├── xunit.runner.json │ ├── paket.references │ ├── FSharp.Quotations.Evaluator.Tests.fsproj │ ├── Tools.fs │ └── Performance.fs ├── global.json ├── docs ├── files │ └── img │ │ ├── logo.pdn │ │ └── logo.png ├── tools │ ├── templates │ │ └── template.cshtml │ └── generate.fsx └── content │ ├── tutorial.fsx │ └── index.fsx ├── .travis.yml ├── Directory.Build.targets ├── appveyor.yml ├── .config └── dotnet-tools.json ├── docker-build.sh ├── Dockerfile ├── .github └── ISSUE_TEMPLATE.md ├── paket.dependencies ├── README.md ├── LICENSE.txt ├── RELEASE_NOTES.md ├── Directory.Build.props ├── .gitattributes ├── .gitignore ├── .dockerignore ├── FSharp.Quotations.Evaluator.sln ├── .paket └── Paket.Restore.targets └── paket.lock /src/FSharp.Quotations.Evaluator/paket.references: -------------------------------------------------------------------------------- 1 | FSharp.Core 2 | Microsoft.SourceLink.GitHub -------------------------------------------------------------------------------- /tests/FSharp.Quotations.Evaluator.Tests/xunit.runner.json: -------------------------------------------------------------------------------- 1 | { 2 | "appDomain" : "denied" 3 | } -------------------------------------------------------------------------------- /global.json: -------------------------------------------------------------------------------- 1 | { 2 | "sdk": { 3 | "version": "3.1.100", 4 | "rollForward": "minor" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /docs/files/img/logo.pdn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fsprojects/FSharp.Quotations.Evaluator/HEAD/docs/files/img/logo.pdn -------------------------------------------------------------------------------- /docs/files/img/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fsprojects/FSharp.Quotations.Evaluator/HEAD/docs/files/img/logo.png -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | os: linux 2 | language: bash 3 | 4 | services: 5 | - docker 6 | 7 | script: 8 | - ./docker-build.sh -t Bundle -------------------------------------------------------------------------------- /tests/FSharp.Quotations.Evaluator.Tests/paket.references: -------------------------------------------------------------------------------- 1 | group Tests 2 | FSharp.Core 3 | xunit 4 | xunit.runner.visualstudio 5 | Microsoft.NET.Test.Sdk -------------------------------------------------------------------------------- /Directory.Build.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | os: Visual Studio 2019 2 | 3 | init: 4 | - git config --global core.autocrlf input 5 | build_script: 6 | - cmd: build.cmd -t Bundle 7 | test: off 8 | version: 0.0.1.{build} 9 | artifacts: 10 | - path: artifacts -------------------------------------------------------------------------------- /src/FSharp.Quotations.Evaluator/Script.fsx: -------------------------------------------------------------------------------- 1 | // Learn more about F# at http://fsharp.org. See the 'F# Tutorial' project 2 | // for more guidance on F# programming. 3 | 4 | #load "Library.fs" 5 | open FSharp.Quotations.Evaluator 6 | 7 | let num = Library.hello 42 8 | printfn "%i" num 9 | -------------------------------------------------------------------------------- /.config/dotnet-tools.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 1, 3 | "isRoot": true, 4 | "tools": { 5 | "paket": { 6 | "version": "5.242.2", 7 | "commands": [ 8 | "paket" 9 | ] 10 | }, 11 | "fake-cli": { 12 | "version": "5.19.1", 13 | "commands": [ 14 | "fake" 15 | ] 16 | }, 17 | "sourcelink": { 18 | "version": "3.1.1", 19 | "commands": [ 20 | "sourcelink" 21 | ] 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /docker-build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | cd `dirname $0` 4 | 5 | IMAGE_LABEL="fsharp-quotations-evaluator-build" 6 | 7 | # docker build 8 | docker build \ 9 | --build-arg "GIT_USER_NAME=$(git config user.name)" \ 10 | --build-arg "GIT_USER_EMAIL=$(git config user.email)" \ 11 | -t $IMAGE_LABEL \ 12 | . 13 | 14 | # dotnet build, test & nuget publish 15 | docker run --rm \ 16 | -e GITHUB_TOKEN=$GITHUB_TOKEN \ 17 | -e NUGET_KEY=$NUGET_KEY \ 18 | $IMAGE_LABEL \ 19 | ./build.sh "$@" -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM eiriktsarpalis/dotnet-sdk-mono:3.1.101-buster 2 | 3 | # allow pushing docs & tags using docker builds: 4 | # pass git credentials using $GITHUB_TOKEN environment variable 5 | ARG GIT_ASKPASS=/root/.git-askpass 6 | ENV GIT_ASKPASS=$GIT_ASKPASS 7 | RUN echo 'echo $GITHUB_TOKEN' > $GIT_ASKPASS && \ 8 | chmod +x $GIT_ASKPASS 9 | 10 | # configure git name & email using params 11 | ARG GIT_USER_NAME 12 | ARG GIT_USER_EMAIL 13 | RUN git config --global user.name "$GIT_USER_NAME" && \ 14 | git config --global user.email "$GIT_USER_EMAIL" 15 | 16 | WORKDIR /app 17 | COPY . . 18 | 19 | CMD ./build.sh -t Bundle 20 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ### Description 2 | 3 | Please provide a succinct description of your issue. 4 | 5 | ### Repro steps 6 | 7 | Please provide the steps required to reproduce the problem 8 | 9 | 1. Step A 10 | 11 | 2. Step B 12 | 13 | ### Expected behavior 14 | 15 | Please provide a description of the behavior you expect. 16 | 17 | ### Actual behavior 18 | 19 | Please provide a description of the actual behavior you observe. 20 | 21 | ### Known workarounds 22 | 23 | Please provide a description of any known workarounds. 24 | 25 | ### Related information 26 | 27 | * Operating system 28 | * Branch 29 | * .NET Runtime, CoreCLR or Mono Version 30 | * Performance information, links to performance testing scripts 31 | -------------------------------------------------------------------------------- /tests/FSharp.Quotations.Evaluator.Tests/FSharp.Quotations.Evaluator.Tests.fsproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp3.1;net472 5 | true 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | PreserveNewest 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /paket.dependencies: -------------------------------------------------------------------------------- 1 | source https://api.nuget.org/v3/index.json 2 | framework: netstandard2.0 3 | storage: none 4 | 5 | nuget FSharp.Core >= 4.3 lowest_matching: true 6 | nuget Microsoft.SourceLink.GitHub ~> 1.0 copy_local: true 7 | 8 | group Tests 9 | source https://api.nuget.org/v3/index.json 10 | framework: netcoreapp3.1, net472 11 | storage: none 12 | 13 | nuget FSharp.Core >= 4.7 14 | nuget xunit ~> 2.4 15 | nuget xunit.runner.visualstudio ~> 2.4 16 | nuget Microsoft.NET.Test.Sdk ~> 16.0 17 | 18 | group Build 19 | source https://api.nuget.org/v3/index.json 20 | generate_load_scripts: true 21 | framework: netstandard2.0 22 | storage: none 23 | 24 | nuget Fake.Core.UserInput ~> 5.19.0 25 | nuget Fake.Core.ReleaseNotes ~> 5.19.0 26 | nuget Fake.Core.Target ~> 5.19.0 27 | nuget Fake.IO.FileSystem ~> 5.19.0 28 | nuget Fake.DotNet.Cli ~> 5.19.0 29 | nuget Fake.Tools.Git ~> 5.19.0 30 | 31 | nuget FSharp.Formatting ~> 4.0 prerelease storage: packages -------------------------------------------------------------------------------- /src/FSharp.Quotations.Evaluator/FSharp.Quotations.Evaluator.fsproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | true 6 | true 7 | true 8 | 9 | 10 | 11 | 5 12 | 52,1178 13 | --warnon:1182 14 | true 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | F# Quotations Evaluator [![NuGet Status](http://img.shields.io/nuget/v/FSharp.Quotations.Evaluator.svg?style=flat)](https://www.nuget.org/packages/FSharp.Quotations.Evaluator/) [![Docker Build Status](https://travis-ci.org/fsprojects/FSharp.Quotations.Evaluator.svg?branch=master)](https://travis-ci.org/fsprojects/FSharp.Quotations.Evaluator) 2 | ======================= 3 | 4 | See http://fsprojects.github.io/FSharp.Quotations.Evaluator/ 5 | 6 | ### Build and Release 7 | 8 | - Open, edit, build and test using ``FSharp.Quotations.Evaluator.sln`` 9 | - Build and test release binaries using ``build.cmd`` or ``build.sh`` 10 | - Build and test release packages using ``build.cmd -t Release`` or ``build.sh -t Release`` 11 | 12 | ### Maintainer(s) 13 | 14 | - [@manofstick](https://github.com/manofstick) - Paul Westcott 15 | - [@eiriktsarpalis](https://github.com/eiriktsarpalis) - Eirik Tsarpalis 16 | 17 | The default maintainer account for projects under "fsprojects" is [@fsprojectsgit](https://github.com/fsprojectsgit) - F# Community Project Incubation Space (repo management) 18 | 19 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /RELEASE_NOTES.md: -------------------------------------------------------------------------------- 1 | ### 2.1.0 - Bug fix 2 | * Fix "Argument types do not match" on nested if statement. 3 | 4 | ### 2.0.0 - Support NetStandard2.0 only. 5 | * Deprecate net45 target. 6 | 7 | ### 1.1.3 - Bug fix 8 | * Fix #26. Bug due to type arguments not being convariant, and thus 9 | crashing on cast. 10 | 11 | ### 1.1.2 - Support NetStandard2.0 12 | * Fix packaging issue. 13 | 14 | ### 1.1.1 - Support NetStandard2.0 15 | * Fix packaging issue. 16 | 17 | ### 1.1.0 - Support NetStandard2.0 18 | * Add support for NetStandard2.0 19 | * Add support for FieldSet expressions. 20 | 21 | ### 1.0.7 - Add portable profile 7 support 22 | * Add portable profile 7, allowing use on .NET Core 23 | 24 | ### 1.0.6 - Fixes for "casts" 25 | * duplicate f# functionality where 'cast' functions parse strings 26 | 27 | ### 1.0.5 - Skipped due to my [manofstick] stuffing up version 28 | 29 | ### 1.0.4 - 'let rec' performance improvements 30 | * simplification refactorings 31 | * (my) stylistic code formatting 32 | 33 | ### 1.0.3 - A range of performance improvements 34 | 35 | ### 1.0.2 - Using System.Linq.Expressions .net 4.0+ functionality 36 | * Updated release notes 37 | 38 | ### 1.0.1 - Update release 39 | * Updated release notes 40 | 41 | ### 1.0 - Initial release 42 | * Source code from F# Power Pack Dec2012 release 43 | * Added SourceLink for Source Indexing PDB -------------------------------------------------------------------------------- /Directory.Build.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | false 4 | true 5 | 6 | 7 | 8 | 9 | logo.png 10 | A quotations evaluator for F# based on LINQ expression tree compilation. Some constructs are not supported and performance may be slower than F# compiled code. Based on the old F# 2.0 PowerPack code. 11 | F# Software Foundation 12 | 2019 13 | FSharp F# Quotations Evaluator 14 | https://github.com/fsprojects/FSharp.Quotations.Evaluator 15 | http://fsprojects.github.io/FSharp.Quotations.Evaluator 16 | Unlicense 17 | git 18 | 19 | true 20 | true 21 | $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/FSharp.Quotations.Evaluator/Public.fs: -------------------------------------------------------------------------------- 1 | namespace FSharp.Quotations.Evaluator 2 | 3 | [] 4 | [] 5 | do () 6 | 7 | /// A set of types used for implementing quotation conversions. 8 | /// These are public only because targets of Linq Lambda expressions require them to be so 9 | module HelperTypes = 10 | type FuncHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10,'T11,'T12,'T13,'T14,'T15,'T16,'T17,'TResult> = delegate of 'T1*'T2*'T3*'T4*'T5*'T6*'T7*'T8*'T9*'T10*'T11*'T12*'T13*'T14*'T15*'T16*'T17 -> 'TResult 11 | type FuncHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10,'T11,'T12,'T13,'T14,'T15,'T16,'T17,'T18,'TResult> = delegate of 'T1*'T2*'T3*'T4*'T5*'T6*'T7*'T8*'T9*'T10*'T11*'T12*'T13*'T14*'T15*'T16*'T17*'T18 -> 'TResult 12 | type FuncHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10,'T11,'T12,'T13,'T14,'T15,'T16,'T17,'T18,'T19,'TResult> = delegate of 'T1*'T2*'T3*'T4*'T5*'T6*'T7*'T8*'T9*'T10*'T11*'T12*'T13*'T14*'T15*'T16*'T17*'T18*'T19 -> 'TResult 13 | type FuncHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10,'T11,'T12,'T13,'T14,'T15,'T16,'T17,'T18,'T19,'T20,'TResult> = delegate of 'T1*'T2*'T3*'T4*'T5*'T6*'T7*'T8*'T9*'T10*'T11*'T12*'T13*'T14*'T15*'T16*'T17*'T18*'T19*'T20 -> 'TResult 14 | -------------------------------------------------------------------------------- /docs/tools/templates/template.cshtml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | @Title 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 21 | 22 | 23 |
24 |
25 | 29 |

@Properties["project-name"]

30 |
31 |
32 |
33 |
34 | @RenderBody() 35 |
36 |
37 | F# Project 38 | 53 |
54 |
55 |
56 | Fork me on GitHub 57 | 58 | 59 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | # Autodetect text or binary. Do not leave merge conflict markers in the files. 5 | * text=auto merge=union 6 | 7 | # Use LF in the working directory by default. Override with core.autocrlf=true. 8 | *.fs text eol=lf 9 | *.fsi text eol=lf 10 | 11 | # Visual Studio can read LF sln files, but it always writes them as CRLF. 12 | *.sln eol=crlf 13 | 14 | ############################################################################### 15 | # Set default behavior for command prompt diff. 16 | # 17 | # This is need for earlier builds of msysgit that does not have it on by 18 | # default for csharp files. 19 | # Note: This is only used by command line 20 | ############################################################################### 21 | #*.cs diff=csharp 22 | 23 | ############################################################################### 24 | # Set the merge driver for project and solution files 25 | # 26 | # Merging from the command prompt will add diff markers to the files if there 27 | # are conflicts (Merging from VS is not affected by the settings below, in VS 28 | # the diff markers are never inserted). Diff markers may cause the following 29 | # file extensions to fail to load in VS. An alternative would be to treat 30 | # these files as binary and thus will always conflict and require user 31 | # intervention with every merge. To do so, just uncomment the entries below 32 | ############################################################################### 33 | #*.sln merge=binary 34 | #*.csproj merge=binary 35 | #*.vbproj merge=binary 36 | #*.vcxproj merge=binary 37 | #*.vcproj merge=binary 38 | #*.dbproj merge=binary 39 | #*.fsproj merge=binary 40 | #*.lsproj merge=binary 41 | #*.wixproj merge=binary 42 | #*.modelproj merge=binary 43 | #*.sqlproj merge=binary 44 | #*.wwaproj merge=binary 45 | 46 | ############################################################################### 47 | # behavior for image files 48 | # 49 | # image files are treated as binary by default. 50 | ############################################################################### 51 | #*.jpg binary 52 | #*.png binary 53 | #*.gif binary 54 | 55 | ############################################################################### 56 | # diff behavior for common document formats 57 | # 58 | # Convert binary document formats to text before diffing them. This feature 59 | # is only available from the command line. Turn it on by uncommenting the 60 | # entries below. 61 | ############################################################################### 62 | #*.doc diff=astextplain 63 | #*.DOC diff=astextplain 64 | #*.docx diff=astextplain 65 | #*.DOCX diff=astextplain 66 | #*.dot diff=astextplain 67 | #*.DOT diff=astextplain 68 | #*.pdf diff=astextplain 69 | #*.PDF diff=astextplain 70 | #*.rtf diff=astextplain 71 | #*.RTF diff=astextplain 72 | 73 | *.sh text eol=lf 74 | -------------------------------------------------------------------------------- /docs/content/tutorial.fsx: -------------------------------------------------------------------------------- 1 | (*** hide ***) 2 | // This block of code is omitted in the generated HTML documentation. Use 3 | // it to define helpers that you do not want to show in the documentation. 4 | #I "../../src/FSharp.Quotations.Evaluator/bin/Release/netstandard2.0/" 5 | 6 | (** 7 | F# Quotations Evaluator Tutorial 8 | ======================== 9 | 10 | To reference the library: 11 | 12 | *) 13 | #r "FSharp.Quotations.Evaluator.dll" 14 | open FSharp.Quotations.Evaluator 15 | open FSharp.Quotations 16 | 17 | (** 18 | Evaluation 19 | ---------- 20 | 21 | To evaluate a strongly typed quotation: 22 | *) 23 | 24 | QuotationEvaluator.Evaluate <@ 1 + 1 @> // 2 25 | 26 | (** 27 | To evaluate a weakly typed quotation, use `EvaluateUntyped`. An object is returned, which 28 | you can cast to the expected type when it is known. 29 | *) 30 | 31 | let evalTuple n = 32 | let v = Expr.NewTuple (List.replicate n (Expr.Value n)) // codegen (fun x -> (x,x)) 33 | v.EvaluateUntyped() 34 | 35 | evalTuple 4 // obj = (4,4,4,4) 36 | evalTuple 5 // obj = (5,5,5,5,5) 37 | 38 | 39 | (** 40 | Compilation 41 | ----------- 42 | 43 | All evaluation is currently done via compilation. In the future some evalaution may be done via interpretation. 44 | To force compilation, use "Compile". 45 | 46 | *) 47 | 48 | let addPlusOne = QuotationEvaluator.Evaluate <@ fun x y -> x + y + 1 @> 49 | 50 | let nine = addPlusOne 3 5 // 9 51 | 52 | (** 53 | Extension methods 54 | ----------------- 55 | 56 | Extension methods are available for compilation and evaluation: 57 | 58 | *) 59 | 60 | let onePlusOneExpression = <@ 1 + 1 @> // 2 61 | 62 | onePlusOneExpression.Evaluate() 63 | 64 | (** 65 | On-the-fly code generation 66 | -------------------------- 67 | 68 | You can generate lambdas and compile them dynamically: 69 | *) 70 | 71 | 72 | let tupler = 73 | let v = Var("x",typeof) 74 | let v = Expr.Lambda(v, Expr.NewTuple [Expr.Var v; Expr.Var v]) // codegen (fun x -> (x,x)) 75 | v.CompileUntyped() :?> (int -> (int * int)) 76 | 77 | tupler 78 // (78, 78) 78 | 79 | (** 80 | In this example, we generate a lambda (fun x -> (x,...,x)) for tuple size N: 81 | *) 82 | 83 | let invokeFunctionDynamic (f: obj) (x:obj) = 84 | // Invoke an F# function dynamically 85 | f.GetType().InvokeMember("Invoke",System.Reflection.BindingFlags.InvokeMethod,null,f,[| box x |]) 86 | 87 | let makeTupler n = 88 | let xVar = Var("x",typeof) 89 | let lambdaExpr = Expr.Lambda(xVar, Expr.NewTuple (List.replicate n (Expr.Var xVar))) // codegen (fun x -> (x,...,x)) 90 | let compiledLambda = lambdaExpr.CompileUntyped() 91 | fun (v:int) -> 92 | // Invoke the function dynamically 93 | invokeFunctionDynamic compiledLambda v 94 | 95 | // tupler4 and tupler7 are compiled functions which can be invoked with different arguments 96 | let tupler4 = makeTupler 4 97 | let tupler7 = makeTupler 7 98 | 99 | tupler4 76 // (76, 76, 76, 76) 100 | tupler4 63 // (63, 63, 63, 63) 101 | tupler7 65 // (65, 65, 65, 65, 65, 65, 65) 102 | 103 | 104 | (** 105 | Convert to LINQ expressions 106 | -------------------------- 107 | *) 108 | 109 | let onePlusTwoExpression = <@ 1 + 2 @> // 2 110 | 111 | let expressionTree = onePlusTwoExpression.ToLinqExpressionUntyped() // an expression tree 112 | 113 | expressionTree.ToString() // "(1 + 2)" -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.sln.docstates 8 | 9 | # Xamarin Studio / monodevelop user-specific 10 | *.userprefs 11 | 12 | # Build results 13 | 14 | [Dd]ebug/ 15 | [Rr]elease/ 16 | x64/ 17 | build/ 18 | [Bb]in/ 19 | [Oo]bj/ 20 | 21 | # Enable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets 22 | !packages/*/build/ 23 | 24 | # MSTest test Results 25 | [Tt]est[Rr]esult*/ 26 | [Bb]uild[Ll]og.* 27 | 28 | *_i.c 29 | *_p.c 30 | *.ilk 31 | *.meta 32 | *.obj 33 | *.pch 34 | *.pdb 35 | *.pgc 36 | *.pgd 37 | *.rsp 38 | *.sbr 39 | *.tlb 40 | *.tli 41 | *.tlh 42 | *.tmp 43 | *.tmp_proj 44 | *.log 45 | *.vspscc 46 | *.vssscc 47 | .builds 48 | *.pidb 49 | *.log 50 | *.scc 51 | 52 | # Visual C++ cache files 53 | ipch/ 54 | *.aps 55 | *.ncb 56 | *.opensdf 57 | *.sdf 58 | *.cachefile 59 | 60 | # Visual Studio profiler 61 | *.psess 62 | *.vsp 63 | *.vspx 64 | 65 | # Guidance Automation Toolkit 66 | *.gpState 67 | 68 | # ReSharper is a .NET coding add-in 69 | _ReSharper*/ 70 | *.[Rr]e[Ss]harper 71 | 72 | # TeamCity is a build add-in 73 | _TeamCity* 74 | 75 | # DotCover is a Code Coverage Tool 76 | *.dotCover 77 | 78 | # NCrunch 79 | *.ncrunch* 80 | .*crunch*.local.xml 81 | 82 | # Installshield output folder 83 | [Ee]xpress/ 84 | 85 | # DocProject is a documentation generator add-in 86 | DocProject/buildhelp/ 87 | DocProject/Help/*.HxT 88 | DocProject/Help/*.HxC 89 | DocProject/Help/*.hhc 90 | DocProject/Help/*.hhk 91 | DocProject/Help/*.hhp 92 | DocProject/Help/Html2 93 | DocProject/Help/html 94 | 95 | # Click-Once directory 96 | publish/ 97 | 98 | # Publish Web Output 99 | *.Publish.xml 100 | 101 | # Enable nuget.exe in the .nuget folder (though normally executables are not tracked) 102 | !.nuget/NuGet.exe 103 | 104 | # Windows Azure Build Output 105 | csx 106 | *.build.csdef 107 | 108 | # Windows Store app package directory 109 | AppPackages/ 110 | 111 | # Others 112 | sql/ 113 | *.Cache 114 | ClientBin/ 115 | [Ss]tyle[Cc]op.* 116 | ~$* 117 | *~ 118 | *.dbmdl 119 | *.[Pp]ublish.xml 120 | *.pfx 121 | *.publishsettings 122 | 123 | # RIA/Silverlight projects 124 | Generated_Code/ 125 | 126 | # Backup & report files from converting an old project file to a newer 127 | # Visual Studio version. Backup files are not needed, because we have git ;-) 128 | _UpgradeReport_Files/ 129 | Backup*/ 130 | UpgradeLog*.XML 131 | UpgradeLog*.htm 132 | 133 | # SQL Server files 134 | App_Data/*.mdf 135 | App_Data/*.ldf 136 | 137 | 138 | #LightSwitch generated files 139 | GeneratedArtifacts/ 140 | _Pvt_Extensions/ 141 | ModelManifest.xml 142 | 143 | # ========================= 144 | # Windows detritus 145 | # ========================= 146 | 147 | # Windows image file caches 148 | Thumbs.db 149 | ehthumbs.db 150 | 151 | # Folder config file 152 | Desktop.ini 153 | 154 | # Recycle Bin used on file shares 155 | $RECYCLE.BIN/ 156 | 157 | # Mac desktop service store files 158 | .DS_Store 159 | 160 | # =================================================== 161 | # Exclude F# project specific directories and files 162 | # =================================================== 163 | 164 | # NuGet Packages Directory 165 | packages/ 166 | 167 | # Generated documentation folder 168 | docs/output/ 169 | 170 | # Temp folder used for publishing docs 171 | temp/ 172 | 173 | # Test results produced by build 174 | TestResults.xml 175 | 176 | # Nuget outputs 177 | nuget/*.nupkg 178 | 179 | # Fake build files 180 | .fake/ 181 | 182 | # paket 183 | paket-files/ 184 | 185 | # Visual Studio 186 | .vs/ 187 | 188 | # Ionide 189 | .ionide/ 190 | 191 | # Nuget artifacts 192 | artifacts/ 193 | -------------------------------------------------------------------------------- /docs/content/index.fsx: -------------------------------------------------------------------------------- 1 | (*** hide ***) 2 | // This block of code is omitted in the generated HTML documentation. Use 3 | // it to define helpers that you do not want to show in the documentation. 4 | #I "../../src/FSharp.Quotations.Evaluator/bin/Release/netstandard2.0/" 5 | 6 | (** 7 | F# Quotations Evaluator 8 | =================== 9 | 10 | Documentation 11 | 12 |
13 |
14 |
15 |
16 | The F# Quotations Evaluator library can be installed from NuGet: 17 |
PM> Install-Package FSharp.Quotations.Evaluator
18 |
19 |
20 |
21 |
22 | 23 | Overview 24 | ------- 25 | 26 | This component is an F# quotations evaluator, implemented by compiling to LINQ expression trees. 27 | 28 | For simple expression-based scenarios you may be able to simply use the method 29 | ```FSharp.Linq.RuntimeHelpers.LeafExpressionConverter.EvaluateQuotation``` from ```FSharp.Core.dll``. 30 | 31 | However that component has restrictions in the quotations accepted - for example, statements such as 32 | while-loops are not accepted. This component accepts more quotations (including those involving statements), 33 | though some restrictions remain. Please help by contributing additional 34 | functionality to lift remaining restrictions. 35 | 36 | Performance of generated code is generally OK though not as good as F# compiled code, expecially for recursive functions. 37 | However it is still good enough for many purposes of dynamic code generation. Contributions to improve performance 38 | are welcome. 39 | 40 | The component requires .NET 4.x. It is not usable on mobile devices or portable profiles, 41 | where code generation APIs are not available. 42 | 43 | Example 44 | ------- 45 | 46 | This example demonstrates using a function defined in this sample library. 47 | 48 | *) 49 | #r "FSharp.Quotations.Evaluator.dll" 50 | open FSharp.Quotations.Evaluator 51 | 52 | QuotationEvaluator.Evaluate <@ 1 + 1 @> 53 | 54 | let addPlusOne = QuotationEvaluator.Evaluate <@ fun x y -> x + y + 1 @> 55 | 56 | let nine = addPlusOne 3 5 // gives 9 57 | 58 | 59 | (** 60 | 61 | Samples & documentation 62 | ----------------------- 63 | 64 | The library comes with comprehensible documentation. 65 | It can include a tutorials automatically generated from `*.fsx` files in [the content folder][content]. 66 | The API reference is automatically generated from Markdown comments in the library implementation. 67 | 68 | * [Tutorial](tutorial.html) contains a further explanation of this sample library. 69 | 70 | * [API Reference](reference/index.html) contains automatically generated documentation for all types, modules 71 | and functions in the library. This includes additional brief samples on using most of the 72 | functions. 73 | 74 | Contributing and copyright 75 | -------------------------- 76 | 77 | The project is hosted on [GitHub][gh] where you can [report issues][issues], fork 78 | the project and submit pull requests. If you're adding new public API, please also 79 | consider adding [samples][content] that can be turned into a documentation. You might 80 | also want to read [library design notes][readme] to understand how it works. 81 | 82 | The library is available under Public Domain license, which allows modification and 83 | redistribution for both commercial and non-commercial purposes. For more information see the 84 | [License file][license] in the GitHub repository. 85 | 86 | [content]: https://github.com/fsprojects/FSharp.Quotations.Evaluator/tree/master/docs/content 87 | [gh]: https://github.com/fsprojects/FSharp.Quotations.Evaluator 88 | [issues]: https://github.com/fsprojects/FSharp.Quotations.Evaluator/issues 89 | [readme]: https://github.com/fsprojects/FSharp.Quotations.Evaluator/blob/master/README.md 90 | [license]: https://github.com/fsprojects/FSharp.Quotations.Evaluator/blob/master/LICENSE.txt 91 | *) 92 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | **/*.suo 6 | **/*.user 7 | **/*.sln.docstates 8 | 9 | # Xamarin Studio / monodevelop user-specific 10 | **/*.userprefs 11 | 12 | # Build results 13 | 14 | **/[Dd]ebug/ 15 | **/[Rr]elease/ 16 | **/x64/ 17 | **/build/ 18 | **/[Bb]in/ 19 | **/[Oo]bj/ 20 | 21 | # Enable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets 22 | !**/packages/*/build/ 23 | 24 | # MSTest test Results 25 | **/[Tt]est[Rr]esult*/ 26 | **/[Bb]uild[Ll]og.* 27 | 28 | **/*_i.c 29 | **/*_p.c 30 | **/*.ilk 31 | **/*.meta 32 | **/*.obj 33 | **/*.pch 34 | **/*.pdb 35 | **/*.pgc 36 | **/*.pgd 37 | **/*.rsp 38 | **/*.sbr 39 | **/*.tlb 40 | **/*.tli 41 | **/*.tlh 42 | **/*.tmp 43 | **/*.tmp_proj 44 | **/*.log 45 | **/*.vspscc 46 | **/*.vssscc 47 | **/.builds 48 | **/*.pidb 49 | **/*.log 50 | **/*.scc 51 | 52 | # Visual C++ cache files 53 | **/ipch/ 54 | **/*.aps 55 | **/*.ncb 56 | **/*.opensdf 57 | **/*.sdf 58 | **/*.cachefile 59 | 60 | # Visual Studio profiler 61 | **/*.psess 62 | **/*.vsp 63 | **/*.vspx 64 | 65 | # Guidance Automation Toolkit 66 | **/*.gpState 67 | 68 | # ReSharper is a .NET coding add-in 69 | **/_ReSharper*/ 70 | **/*.[Rr]e[Ss]harper 71 | 72 | # TeamCity is a build add-in 73 | **/_TeamCity* 74 | 75 | # DotCover is a Code Coverage Tool 76 | **/*.dotCover 77 | 78 | # NCrunch 79 | **/*.ncrunch* 80 | **/.*crunch*.local.xml 81 | 82 | # Installshield output folder 83 | **/[Ee]xpress/ 84 | 85 | # DocProject is a documentation generator add-in 86 | **/DocProject/buildhelp/ 87 | **/DocProject/Help/*.HxT 88 | **/DocProject/Help/*.HxC 89 | **/DocProject/Help/*.hhc 90 | **/DocProject/Help/*.hhk 91 | **/DocProject/Help/*.hhp 92 | **/DocProject/Help/Html2 93 | **/DocProject/Help/html 94 | 95 | # Click-Once directory 96 | **/publish/ 97 | 98 | # Publish Web Output 99 | **/*.Publish.xml 100 | 101 | # Enable nuget.exe in the .nuget folder (though normally executables are not tracked) 102 | !**/.nuget/NuGet.exe 103 | 104 | # Windows Azure Build Output 105 | **/csx 106 | **/*.build.csdef 107 | 108 | # Windows Store app package directory 109 | **/AppPackages/ 110 | 111 | # Others 112 | **/sql/ 113 | **/*.Cache 114 | **/ClientBin/ 115 | **/[Ss]tyle[Cc]op.* 116 | **/~$* 117 | **/*~ 118 | **/*.dbmdl 119 | **/*.[Pp]ublish.xml 120 | **/*.pfx 121 | **/*.publishsettings 122 | 123 | # RIA/Silverlight projects 124 | **/Generated_Code/ 125 | 126 | # Backup & report files from converting an old project file to a newer 127 | # Visual Studio version. Backup files are not needed, because we have git ;-) 128 | **/_UpgradeReport_Files/ 129 | **/Backup*/ 130 | **/UpgradeLog*.XML 131 | **/UpgradeLog*.htm 132 | 133 | # SQL Server files 134 | **/App_Data/*.mdf 135 | **/App_Data/*.ldf 136 | 137 | 138 | #LightSwitch generated files 139 | **/GeneratedArtifacts/ 140 | **/_Pvt_Extensions/ 141 | **/ModelManifest.xml 142 | 143 | # ========================= 144 | # Windows detritus 145 | # ========================= 146 | 147 | # Windows image file caches 148 | **/Thumbs.db 149 | **/ehthumbs.db 150 | 151 | # Folder config file 152 | **/Desktop.ini 153 | 154 | # Recycle Bin used on file shares 155 | **/$RECYCLE.BIN/ 156 | 157 | # Mac desktop service store files 158 | **/.DS_Store 159 | 160 | # =================================================== 161 | # Exclude F# project specific directories and files 162 | # =================================================== 163 | 164 | # NuGet Packages Directory 165 | **/packages/ 166 | 167 | # Generated documentation folder 168 | **/docs/output/ 169 | 170 | # Temp folder used for publishing docs 171 | **/temp/ 172 | 173 | # Test results produced by build 174 | **/TestResults.xml 175 | 176 | # Nuget outputs 177 | **/nuget/*.nupkg 178 | 179 | # Fake build files 180 | **/.fake/ 181 | 182 | # paket 183 | **/paket-files/ 184 | 185 | # Visual Studio 186 | **/.vs/ 187 | 188 | # Ionide 189 | **/.ionide/ 190 | 191 | # Nuget artifacts 192 | **/artifacts/ 193 | -------------------------------------------------------------------------------- /docs/tools/generate.fsx: -------------------------------------------------------------------------------- 1 | // -------------------------------------------------------------------------------------- 2 | // Builds the documentation from `.fsx` and `.md` files in the 'docs/content' directory 3 | // (the generated documentation is stored in the 'docs/output' directory) 4 | // -------------------------------------------------------------------------------------- 5 | #load "../../.paket/load/netstandard2.0/Build/build.group.fsx" 6 | 7 | open System 8 | open System.IO 9 | open Fake.IO 10 | open Fake.IO.FileSystemOperators 11 | open Fake.IO.Globbing.Operators 12 | open FSharp.Formatting.Razor 13 | 14 | Environment.CurrentDirectory <- __SOURCE_DIRECTORY__ 15 | 16 | // Binaries that have XML documentation (in a corresponding generated XML file) 17 | let referenceProjects = [ "../../src/FSharp.Quotations.Evaluator" ] 18 | // Web site location for the generated documentation 19 | let website = "/FSharp.Quotations.Evaluator" 20 | 21 | let githubLink = "http://github.com/fsprojects/FSharp.Quotations.Evaluator" 22 | 23 | // Specify more information about your project 24 | let info = 25 | [ "project-name", "FSharp.Quotations.Evaluator" 26 | "project-author", "F# Software Foundation" 27 | "project-summary", "A quotations evaluator for F# based on LINQ expression tree compilation" 28 | "project-github", githubLink 29 | "project-nuget", "http://nuget.org/packages/FSharp.Quotations.Evaluator" ] 30 | 31 | // -------------------------------------------------------------------------------------- 32 | // For typical project, no changes are needed below 33 | // -------------------------------------------------------------------------------------- 34 | 35 | // When called from 'build.fsx', use the public project URL as 36 | // otherwise, use the current 'output' directory. 37 | #if RELEASE 38 | let root = website 39 | #else 40 | let root = "file://" + (__SOURCE_DIRECTORY__ @@ "../output") 41 | #endif 42 | 43 | // Paths with template/source/output locations 44 | let bin = __SOURCE_DIRECTORY__ @@ "../../bin" 45 | let content = __SOURCE_DIRECTORY__ @@ "../content" 46 | let output = __SOURCE_DIRECTORY__ @@ "../output" 47 | let files = __SOURCE_DIRECTORY__ @@ "../files" 48 | let templates = __SOURCE_DIRECTORY__ @@ "templates" 49 | let formatting = __SOURCE_DIRECTORY__ @@ "../../packages/build/FSharp.Formatting/" 50 | let docTemplate = formatting @@ "templates/docpage.cshtml" 51 | 52 | // Where to look for *.csproj templates (in this order) 53 | let layoutRoots = 54 | [ templates; formatting @@ "templates" 55 | formatting @@ "templates/reference" ] 56 | 57 | // Copy static files and CSS + JS from F# Formatting 58 | let copyFiles () = 59 | Fake.IO.DirectoryInfo.copyRecursiveTo true (DirectoryInfo output) (DirectoryInfo files) |> ignore 60 | Fake.IO.Directory.ensure (output @@ "content") 61 | Fake.IO.DirectoryInfo.copyRecursiveTo true (DirectoryInfo (output @@ "content")) (DirectoryInfo (formatting @@ "styles")) |> ignore 62 | 63 | let getReferenceAssembliesForProject (proj : string) = 64 | let projName = Path.GetFileName proj 65 | !! (proj @@ "bin/Release/net*/" + projName + ".dll") |> Seq.head 66 | 67 | // Build API reference from XML comments 68 | let buildReference () = 69 | Shell.cleanDir (output @@ "reference") 70 | let binaries = referenceProjects |> List.map getReferenceAssembliesForProject 71 | RazorMetadataFormat.Generate 72 | ( binaries, output @@ "reference", layoutRoots, 73 | parameters = ("root", root)::info, 74 | sourceRepo = githubLink @@ "tree/master", 75 | sourceFolder = __SOURCE_DIRECTORY__ @@ ".." @@ "..", 76 | publicOnly = true ) 77 | 78 | // Build documentation from `fsx` and `md` files in `docs/content` 79 | let buildDocumentation () = 80 | let subdirs = Directory.EnumerateDirectories(content, "*", SearchOption.AllDirectories) 81 | for dir in Seq.append [content] subdirs do 82 | let sub = if dir.Length > content.Length then dir.Substring(content.Length + 1) else "." 83 | RazorLiterate.ProcessDirectory 84 | ( dir, docTemplate, output @@ sub, replacements = ("root", root)::info, 85 | layoutRoots = layoutRoots, generateAnchors = true ) 86 | 87 | // Generate 88 | Shell.cleanDir output 89 | Shell.mkdir output 90 | copyFiles() 91 | buildDocumentation() 92 | buildReference() 93 | -------------------------------------------------------------------------------- /src/FSharp.Quotations.Evaluator/QuotationsEvaluator.fsi: -------------------------------------------------------------------------------- 1 | // (c) Microsoft Corporation 2005-2009. 2 | 3 | namespace FSharp.Quotations.Evaluator 4 | 5 | open System 6 | open System.Linq.Expressions 7 | 8 | module ExtraHashCompare = 9 | /// An intrinsic for compiling <@ x <> y @> to expression trees 10 | val GenericNotEqualIntrinsic : 'T -> 'T -> bool 11 | 12 | [] 13 | type QuotationEvaluator = 14 | 15 | /// Convert the quotation expression to LINQ expression trees 16 | /// 17 | /// This operation will only succeed for a subset of quotation expressions. 18 | /// 19 | /// Exceptions: InvalidArgumentException will be raised if the input expression is 20 | /// not in the subset that can be converted to a LINQ expression tree 21 | static member ToLinqExpression : FSharp.Quotations.Expr -> System.Linq.Expressions.Expression 22 | 23 | /// Compile the quotation expression by first converting to LINQ expression trees 24 | /// The expression is currently always compiled. 25 | /// 26 | /// Exceptions: InvalidArgumentException will be raised if the input expression is 27 | /// not in the subset that can be converted to a LINQ expression tree 28 | static member CompileUntyped : FSharp.Quotations.Expr -> obj 29 | 30 | /// Compile the quotation expression by first converting to LINQ expression trees 31 | /// 32 | /// Exceptions: InvalidArgumentException will be raised if the input expression is 33 | /// not in the subset that can be converted to a LINQ expression tree 34 | static member EvaluateUntyped : FSharp.Quotations.Expr -> obj 35 | 36 | static member internal EvaluateUntypedUsingQueryApproximations : FSharp.Quotations.Expr -> obj 37 | 38 | /// Compile the quotation expression by first converting to LINQ expression trees 39 | /// The expression is currently always compiled. 40 | /// 41 | /// Exceptions: InvalidArgumentException will be raised if the input expression is 42 | /// not in the subset that can be converted to a LINQ expression tree 43 | [] 44 | static member Compile : FSharp.Quotations.Expr<'T> -> 'T 45 | 46 | /// Evaluate the quotation expression by first converting to LINQ expression trees 47 | /// 48 | /// Exceptions: InvalidArgumentException will be raised if the input expression is 49 | /// not in the subset that can be converted to a LINQ expression tree 50 | static member Evaluate : FSharp.Quotations.Expr<'T> -> 'T 51 | 52 | /// This module provides Compile and Eval extension members 53 | /// for F# quotation values, implemented by translating to LINQ 54 | /// expression trees and using the LINQ dynamic compiler. 55 | [] 56 | module QuotationEvaluationExtensions = 57 | 58 | type FSharp.Quotations.Expr with 59 | /// Convert the quotation expression to a LINQ expression tree. 60 | /// 61 | /// Exceptions: InvalidArgumentException will be raised if the input expression is 62 | /// not in the subset that can be converted to a LINQ expression tree 63 | member ToLinqExpressionUntyped : unit -> Expression 64 | 65 | type FSharp.Quotations.Expr<'T> with 66 | 67 | /// Compile and evaluate the quotation expression by first converting to LINQ expression trees. 68 | /// The expression is currently always compiled. 69 | /// 70 | /// Exceptions: InvalidArgumentException will be raised if the input expression is 71 | /// not in the subset that can be converted to a LINQ expression tree 72 | member Compile : unit -> 'T 73 | 74 | /// Evaluate the quotation expression by first converting to LINQ expression trees. 75 | /// The expression is currently always compiled. 76 | /// 77 | /// Exceptions: InvalidArgumentException will be raised if the input expression is 78 | /// not in the subset that can be converted to a LINQ expression tree 79 | member Evaluate : unit -> 'T 80 | 81 | type FSharp.Quotations.Expr with 82 | 83 | /// Compile and evaluate the quotation expression by first converting to LINQ expression trees. 84 | /// 85 | /// Exceptions: InvalidArgumentException will be raised if the input expression is 86 | /// not in the subset that can be converted to a LINQ expression tree 87 | member CompileUntyped : unit -> obj 88 | 89 | /// Evaluate the quotation expression by first converting to LINQ expression trees. 90 | /// The expression is currently always compiled. 91 | /// 92 | /// Exceptions: InvalidArgumentException will be raised if the input expression is 93 | /// not in the subset that can be converted to a LINQ expression tree 94 | member EvaluateUntyped : unit -> obj 95 | 96 | module QuotationEvaluationTypes = 97 | /// This function should not be called directly. 98 | // 99 | // NOTE: when an F# expression tree is converted to a Linq expression tree using ToLinqExpression 100 | // the transformation of LinqExpressionHelper(e) is simple the same as the transformation of 101 | // 'e'. This allows LinqExpressionHelper to be used as a marker to satisfy the C# design where 102 | // certain expression trees are constructed using methods with a signature that expects an 103 | // expression tree of type Expression but are passed an expression tree of type T. 104 | val LinqExpressionHelper : 'T -> Expression<'T> 105 | -------------------------------------------------------------------------------- /FSharp.Quotations.Evaluator.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 12.00 2 | # Visual Studio Version 16 3 | VisualStudioVersion = 16.0.29515.123 4 | MinimumVisualStudioVersion = 10.0.40219.1 5 | Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Quotations.Evaluator", "src\FSharp.Quotations.Evaluator\FSharp.Quotations.Evaluator.fsproj", "{0A767BB8-BFC6-4622-8063-080188C9EBC4}" 6 | EndProject 7 | Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Quotations.Evaluator.Tests", "tests\FSharp.Quotations.Evaluator.Tests\FSharp.Quotations.Evaluator.Tests.fsproj", "{5EEAE3E8-AE29-4411-B632-4D2E61043094}" 8 | EndProject 9 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".config", ".config", "{B0B99A31-19B9-4970-B148-3CB7274FF231}" 10 | ProjectSection(SolutionItems) = preProject 11 | .config\dotnet-tools.json = .config\dotnet-tools.json 12 | EndProjectSection 13 | EndProject 14 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{4048BFB6-DC54-4910-9B9C-8F0574188931}" 15 | ProjectSection(SolutionItems) = preProject 16 | .github\ISSUE_TEMPLATE.md = .github\ISSUE_TEMPLATE.md 17 | EndProjectSection 18 | EndProject 19 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".paket", ".paket", "{4B8CAB40-6140-49F2-AE4A-34B93AD09D8F}" 20 | ProjectSection(SolutionItems) = preProject 21 | .paket\Paket.Restore.targets = .paket\Paket.Restore.targets 22 | EndProjectSection 23 | EndProject 24 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{7E137503-29B5-4DED-B543-D8DEF5B5A727}" 25 | ProjectSection(SolutionItems) = preProject 26 | .dockerignore = .dockerignore 27 | .gitattributes = .gitattributes 28 | .gitignore = .gitignore 29 | .travis.yml = .travis.yml 30 | appveyor.yml = appveyor.yml 31 | build.cmd = build.cmd 32 | build.fsx = build.fsx 33 | build.sh = build.sh 34 | Directory.Build.props = Directory.Build.props 35 | Directory.Build.targets = Directory.Build.targets 36 | docker-build.sh = docker-build.sh 37 | Dockerfile = Dockerfile 38 | global.json = global.json 39 | LICENSE.txt = LICENSE.txt 40 | paket.dependencies = paket.dependencies 41 | paket.lock = paket.lock 42 | README.md = README.md 43 | RELEASE_NOTES.md = RELEASE_NOTES.md 44 | EndProjectSection 45 | EndProject 46 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{3F4E116C-4942-4EE9-B531-414EA2925B87}" 47 | EndProject 48 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "content", "content", "{8BBA847E-24E1-4F06-AB21-3822CB3EF44C}" 49 | ProjectSection(SolutionItems) = preProject 50 | docs\content\index.fsx = docs\content\index.fsx 51 | docs\content\tutorial.fsx = docs\content\tutorial.fsx 52 | EndProjectSection 53 | EndProject 54 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "files", "files", "{3EEF6D0B-E365-4E96-85E5-8D05F1B729E9}" 55 | EndProject 56 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "img", "img", "{8A491320-622E-4175-9381-37CCC40AC2A7}" 57 | ProjectSection(SolutionItems) = preProject 58 | docs\files\img\logo.pdn = docs\files\img\logo.pdn 59 | docs\files\img\logo.png = docs\files\img\logo.png 60 | EndProjectSection 61 | EndProject 62 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{9AD1FCE9-F3D1-4ECD-A31E-FC1A4FEE0CB8}" 63 | ProjectSection(SolutionItems) = preProject 64 | docs\tools\generate.fsx = docs\tools\generate.fsx 65 | EndProjectSection 66 | EndProject 67 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "templates", "templates", "{2AE853ED-C926-4FE5-BD51-57F15953D3A0}" 68 | ProjectSection(SolutionItems) = preProject 69 | docs\tools\templates\template.cshtml = docs\tools\templates\template.cshtml 70 | EndProjectSection 71 | EndProject 72 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{EAB93A09-6903-4D0C-ADEE-A2E673FD0240}" 73 | EndProject 74 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{ECE849FE-B377-4D05-8DA9-81C35305D540}" 75 | EndProject 76 | Global 77 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 78 | Debug|Any CPU = Debug|Any CPU 79 | Release|Any CPU = Release|Any CPU 80 | EndGlobalSection 81 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 82 | {0A767BB8-BFC6-4622-8063-080188C9EBC4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 83 | {0A767BB8-BFC6-4622-8063-080188C9EBC4}.Debug|Any CPU.Build.0 = Debug|Any CPU 84 | {0A767BB8-BFC6-4622-8063-080188C9EBC4}.Release|Any CPU.ActiveCfg = Release|Any CPU 85 | {0A767BB8-BFC6-4622-8063-080188C9EBC4}.Release|Any CPU.Build.0 = Release|Any CPU 86 | {5EEAE3E8-AE29-4411-B632-4D2E61043094}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 87 | {5EEAE3E8-AE29-4411-B632-4D2E61043094}.Debug|Any CPU.Build.0 = Debug|Any CPU 88 | {5EEAE3E8-AE29-4411-B632-4D2E61043094}.Release|Any CPU.ActiveCfg = Release|Any CPU 89 | {5EEAE3E8-AE29-4411-B632-4D2E61043094}.Release|Any CPU.Build.0 = Release|Any CPU 90 | EndGlobalSection 91 | GlobalSection(SolutionProperties) = preSolution 92 | HideSolutionNode = FALSE 93 | EndGlobalSection 94 | GlobalSection(NestedProjects) = preSolution 95 | {0A767BB8-BFC6-4622-8063-080188C9EBC4} = {EAB93A09-6903-4D0C-ADEE-A2E673FD0240} 96 | {5EEAE3E8-AE29-4411-B632-4D2E61043094} = {ECE849FE-B377-4D05-8DA9-81C35305D540} 97 | {8BBA847E-24E1-4F06-AB21-3822CB3EF44C} = {3F4E116C-4942-4EE9-B531-414EA2925B87} 98 | {3EEF6D0B-E365-4E96-85E5-8D05F1B729E9} = {3F4E116C-4942-4EE9-B531-414EA2925B87} 99 | {8A491320-622E-4175-9381-37CCC40AC2A7} = {3EEF6D0B-E365-4E96-85E5-8D05F1B729E9} 100 | {9AD1FCE9-F3D1-4ECD-A31E-FC1A4FEE0CB8} = {3F4E116C-4942-4EE9-B531-414EA2925B87} 101 | {2AE853ED-C926-4FE5-BD51-57F15953D3A0} = {9AD1FCE9-F3D1-4ECD-A31E-FC1A4FEE0CB8} 102 | EndGlobalSection 103 | GlobalSection(ExtensibilityGlobals) = postSolution 104 | SolutionGuid = {E1E38BB0-7AB3-49FD-B548-0AB537261987} 105 | EndGlobalSection 106 | EndGlobal 107 | -------------------------------------------------------------------------------- /tests/FSharp.Quotations.Evaluator.Tests/Tools.fs: -------------------------------------------------------------------------------- 1 | module FSharp.Quotations.Evaluator.Tools 2 | 3 | open Xunit 4 | open System 5 | open System.Linq.Expressions 6 | open FSharp.Quotations.Evaluator.Tools 7 | 8 | [] 9 | module private Local = 10 | type T1 = class end 11 | type T2 = class end 12 | type T3 = class end 13 | type T4 = class end 14 | type T5 = class end 15 | type T6 = class end 16 | type T7 = class end 17 | type T8 = class end 18 | type T9 = class end 19 | type T10 = class end 20 | type T11 = class end 21 | type T12 = class end 22 | type T13 = class end 23 | type T14 = class end 24 | type T15 = class end 25 | type T16 = class end 26 | type T17 = class end 27 | type T18 = class end 28 | type T19 = class end 29 | type T20 = class end 30 | 31 | let inline constant value = Expression.Constant value 32 | 33 | [] 34 | let ``Test createGenericTupleType types`` () = 35 | let tInt,_ = createGenericTupleType [|typeof|] 36 | Assert.Equal(tInt, typeof>) 37 | let tInt,_ = createGenericTupleType [|typeof;typeof|] 38 | Assert.Equal(tInt, typeof>) 39 | let tInt,_ = createGenericTupleType [|typeof;typeof;typeof|] 40 | Assert.Equal(tInt, typeof>) 41 | let tInt,_ = createGenericTupleType [|typeof;typeof;typeof;typeof|] 42 | Assert.Equal(tInt, typeof>) 43 | let tInt,_ = createGenericTupleType [|typeof;typeof;typeof;typeof;typeof|] 44 | Assert.Equal(tInt, typeof>) 45 | let tInt,_ = createGenericTupleType [|typeof;typeof;typeof;typeof;typeof;typeof|] 46 | Assert.Equal(tInt, typeof>) 47 | let tInt,_ = createGenericTupleType [|typeof;typeof;typeof;typeof;typeof;typeof;typeof|] 48 | Assert.Equal(tInt, typeof>) 49 | let tInt,_ = createGenericTupleType [|typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof|] 50 | Assert.Equal(tInt, typeof>>) 51 | let tInt,_ = createGenericTupleType [|typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof|] 52 | Assert.Equal(tInt, typeof>>) 53 | let tInt,_ = createGenericTupleType [|typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof|] 54 | Assert.Equal(tInt, typeof>>) 55 | let tInt,_ = createGenericTupleType [|typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof|] 56 | Assert.Equal(tInt, typeof>>) 57 | let tInt,_ = createGenericTupleType [|typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof|] 58 | Assert.Equal(tInt, typeof>>) 59 | let tInt,_ = createGenericTupleType [|typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof|] 60 | Assert.Equal(tInt, typeof>>) 61 | let tInt,_ = createGenericTupleType [|typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof|] 62 | Assert.Equal(tInt, typeof>>) 63 | let tInt,_ = createGenericTupleType [|typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof|] 64 | Assert.Equal(tInt, typeof>>>) 65 | let tInt,_ = createGenericTupleType [|typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof|] 66 | Assert.Equal(tInt, typeof>>>) 67 | let tInt,_ = createGenericTupleType [|typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof|] 68 | Assert.Equal(tInt, typeof>>>) 69 | let tInt,_ = createGenericTupleType [|typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof|] 70 | Assert.Equal(tInt, typeof>>>) 71 | let tInt,_ = createGenericTupleType [|typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof|] 72 | Assert.Equal(tInt, typeof>>>) 73 | let tInt,_ = createGenericTupleType [|typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof|] 74 | Assert.Equal(tInt, typeof>>>) 75 | () 76 | 77 | let construct<'a> getConstructor args = 78 | let ``constructor`` = getConstructor args 79 | let creator = Expression.Lambda>(``constructor``).Compile() 80 | creator.Invoke () 81 | 82 | let getItem getConstructor args getItem (n:int) = 83 | let ``constructor`` = getConstructor args 84 | let creator = Expression.Lambda>(getItem ``constructor`` n).Compile() 85 | creator.Invoke () 86 | 87 | [] 88 | let ``Test createGenericTupleType construction`` () = 89 | let _,getConstructor = createGenericTupleType [|typeof|] 90 | let result = construct> getConstructor [| constant 1 |] 91 | Assert.Equal(Tuple.Create 1, result) 92 | 93 | let _,getConstructor = createGenericTupleType [|typeof;typeof|] 94 | let result = construct> getConstructor [| constant 1; constant 2 |] 95 | Assert.Equal(Tuple.Create (1,2), result) 96 | 97 | let _,getConstructor = createGenericTupleType [|typeof;typeof;typeof|] 98 | let result = construct> getConstructor [| constant 1; constant 2; constant 3 |] 99 | Assert.Equal(Tuple.Create (1,2,3), result) 100 | 101 | let _,getConstructor = createGenericTupleType [|typeof;typeof;typeof;typeof|] 102 | let result = construct> getConstructor [| constant 1; constant 2; constant 3; constant 4 |] 103 | Assert.Equal(Tuple.Create (1,2,3,4), result) 104 | 105 | let _,getConstructor = createGenericTupleType [|typeof;typeof;typeof;typeof;typeof|] 106 | let result = construct> getConstructor [| constant 1; constant 2; constant 3; constant 4; constant 5 |] 107 | Assert.Equal(Tuple.Create (1,2,3,4,5), result) 108 | 109 | let _,getConstructor = createGenericTupleType [|typeof;typeof;typeof;typeof;typeof;typeof|] 110 | let result = construct> getConstructor [| constant 1; constant 2; constant 3; constant 4; constant 5; constant 6 |] 111 | Assert.Equal(Tuple.Create (1,2,3,4,5,6), result) 112 | 113 | let _,getConstructor = createGenericTupleType [|typeof;typeof;typeof;typeof;typeof;typeof;typeof|] 114 | let result = construct> getConstructor [| constant 1; constant 2; constant 3; constant 4; constant 5; constant 6; constant 7 |] 115 | Assert.Equal(Tuple.Create (1,2,3,4,5,6,7), result) 116 | 117 | let _,getConstructor = createGenericTupleType [|typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof|] 118 | let result = construct>> getConstructor [| constant 1; constant 2; constant 3; constant 4; constant 5; constant 6; constant 7; constant 8 |] 119 | Assert.Equal(Tuple.Create (1,2,3,4,5,6,7,8), result) 120 | 121 | let _,getConstructor = createGenericTupleType [|typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof|] 122 | let result = construct>> getConstructor [| constant 1; constant 2; constant 3; constant 4; constant 5; constant 6; constant 7; constant 8; constant 9 |] 123 | Assert.Equal((1,2,3,4,5,6,7,8,9), result) 124 | 125 | let _,getConstructor = createGenericTupleType [|typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof|] 126 | let result = construct>> getConstructor [| constant 1; constant 2; constant 3; constant 4; constant 5; constant 6; constant 7; constant 8; constant 9; constant 10 |] 127 | Assert.Equal((1,2,3,4,5,6,7,8,9,10), result) 128 | 129 | let _,getConstructor = createGenericTupleType [|typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof|] 130 | let result = construct>> getConstructor [| constant 1; constant 2; constant 3; constant 4; constant 5; constant 6; constant 7; constant 8; constant 9; constant 10 ; constant 11 |] 131 | Assert.Equal((1,2,3,4,5,6,7,8,9,10,11), result) 132 | 133 | let _,getConstructor = createGenericTupleType [|typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof|] 134 | let result = construct>> getConstructor [| constant 1; constant 2; constant 3; constant 4; constant 5; constant 6; constant 7; constant 8; constant 9; constant 10 ; constant 11; constant 12 |] 135 | Assert.Equal((1,2,3,4,5,6,7,8,9,10,11,12), result) 136 | 137 | let _,getConstructor = createGenericTupleType [|typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof|] 138 | let result = construct>> getConstructor [| constant 1; constant 2; constant 3; constant 4; constant 5; constant 6; constant 7; constant 8; constant 9; constant 10 ; constant 11; constant 12; constant 13 |] 139 | Assert.Equal((1,2,3,4,5,6,7,8,9,10,11,12,13), result) 140 | 141 | let _,getConstructor = createGenericTupleType [|typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof|] 142 | let result = construct>> getConstructor [| constant 1; constant 2; constant 3; constant 4; constant 5; constant 6; constant 7; constant 8; constant 9; constant 10 ; constant 11; constant 12; constant 13; constant 14 |] 143 | Assert.Equal((1,2,3,4,5,6,7,8,9,10,11,12,13,14), result) 144 | 145 | let _,getConstructor = createGenericTupleType [|typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof|] 146 | let result = construct>>> getConstructor [| constant 1; constant 2; constant 3; constant 4; constant 5; constant 6; constant 7; constant 8; constant 9; constant 10 ; constant 11; constant 12; constant 13; constant 14 ; constant 15 |] 147 | Assert.Equal((1,2,3,4,5,6,7,8,9,10,11,12,13,14,15), result) 148 | 149 | let _,getConstructor = createGenericTupleType [|typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof|] 150 | let result = construct>>> getConstructor [| constant 1; constant 2; constant 3; constant 4; constant 5; constant 6; constant 7; constant 8; constant 9; constant 10 ; constant 11; constant 12; constant 13; constant 14 ; constant 15 ; constant 16 |] 151 | Assert.Equal((1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16), result) 152 | 153 | let _,getConstructor = createGenericTupleType [|typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof|] 154 | let result = construct>>> getConstructor [| constant 1; constant 2; constant 3; constant 4; constant 5; constant 6; constant 7; constant 8; constant 9; constant 10 ; constant 11; constant 12; constant 13; constant 14 ; constant 15 ; constant 16 ; constant 17 |] 155 | Assert.Equal((1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17), result) 156 | 157 | let _,getConstructor = createGenericTupleType [|typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof|] 158 | let result = construct>>> getConstructor [| constant 1; constant 2; constant 3; constant 4; constant 5; constant 6; constant 7; constant 8; constant 9; constant 10 ; constant 11; constant 12; constant 13; constant 14 ; constant 15 ; constant 16 ; constant 17; constant 18 |] 159 | Assert.Equal((1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18), result) 160 | 161 | let _,getConstructor = createGenericTupleType [|typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof|] 162 | let result = construct>>> getConstructor [| constant 1; constant 2; constant 3; constant 4; constant 5; constant 6; constant 7; constant 8; constant 9; constant 10 ; constant 11; constant 12; constant 13; constant 14 ; constant 15 ; constant 16 ; constant 17; constant 18 ; constant 19 |] 163 | Assert.Equal((1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19), result) 164 | 165 | let _,getConstructor = createGenericTupleType [|typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof|] 166 | let result = construct>>> getConstructor [| constant 1; constant 2; constant 3; constant 4; constant 5; constant 6; constant 7; constant 8; constant 9; constant 10 ; constant 11; constant 12; constant 13; constant 14 ; constant 15 ; constant 16 ; constant 17; constant 18 ; constant 19 ; constant 20 |] 167 | Assert.Equal((1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20), result) 168 | 169 | [] 170 | let ``Test createGenericTupleType getItem`` () = 171 | let _,getConstructor = createGenericTupleType [|typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof;typeof|] 172 | let getIndexed = getItem getConstructor [| constant -1; constant -2; constant -3; constant -4; constant -5; constant -6; constant -7; constant -8; constant -9; constant -10 ; constant -11; constant -12; constant -13; constant -14 ; constant -15 ; constant -16 ; constant -17; constant -18 ; constant -19 ; constant -20 |] getExpressionFromTuple 173 | Assert.Equal(-1, getIndexed 0) 174 | Assert.Equal(-2, getIndexed 1) 175 | Assert.Equal(-3, getIndexed 2) 176 | Assert.Equal(-4, getIndexed 3) 177 | Assert.Equal(-5, getIndexed 4) 178 | Assert.Equal(-6, getIndexed 5) 179 | Assert.Equal(-7, getIndexed 6) 180 | Assert.Equal(-8, getIndexed 7) 181 | Assert.Equal(-9, getIndexed 8) 182 | Assert.Equal(-10, getIndexed 9) 183 | Assert.Equal(-11, getIndexed 10) 184 | Assert.Equal(-12, getIndexed 11) 185 | Assert.Equal(-13, getIndexed 12) 186 | Assert.Equal(-14, getIndexed 13) 187 | Assert.Equal(-15, getIndexed 14) 188 | Assert.Equal(-16, getIndexed 15) 189 | Assert.Equal(-17, getIndexed 16) 190 | Assert.Equal(-18, getIndexed 17) 191 | Assert.Equal(-19, getIndexed 18) 192 | Assert.Equal(-20, getIndexed 19) 193 | -------------------------------------------------------------------------------- /src/FSharp.Quotations.Evaluator/Tools.fs: -------------------------------------------------------------------------------- 1 | module internal FSharp.Quotations.Evaluator.Tools 2 | 3 | open System.Linq.Expressions 4 | open System 5 | open HelperTypes 6 | open System.Reflection 7 | open FSharp.Quotations 8 | 9 | let rec getExpressionFromTuple (tuple:Expression) idx = 10 | if idx >= 7 11 | then getExpressionFromTuple (Expression.Property(tuple, "Rest")) (idx-7) 12 | else Expression.Property (tuple, "Item" + (idx+1).ToString()) :> Expression 13 | 14 | let createTuple<'a> types = 15 | let tuple = typedefof<'a>.MakeGenericType types 16 | let ``constructor`` = tuple.GetConstructor types 17 | let callConstructor (x:seq) = 18 | Expression.New (``constructor``, x) :> Expression 19 | tuple, callConstructor 20 | 21 | let unitNull = Expression.Constant(null, typeof) :> Expression 22 | 23 | let rec createGenericTupleType (types : Type[]) = 24 | match types.Length with 25 | | 0 -> typeof, (fun _ -> unitNull) 26 | | 1 -> createTuple> types 27 | | 2 -> createTuple> types 28 | | 3 -> createTuple> types 29 | | 4 -> createTuple> types 30 | | 5 -> createTuple> types 31 | | 6 -> createTuple> types 32 | | 7 -> createTuple> types 33 | | _ -> 34 | let slice = types.[7..] 35 | let innerTuple, create = createGenericTupleType slice 36 | let sliceTypes = [| yield! types.[0..6]; yield innerTuple |] 37 | let tuple = typedefof>.MakeGenericType sliceTypes 38 | let ``constructor`` = tuple.GetConstructor sliceTypes 39 | let callConstructor (x:seq) = 40 | let args = [| 41 | yield! Seq.take 7 x 42 | yield create (Seq.skip 7 x) |] 43 | Expression.New(``constructor``, args) :> Expression 44 | tuple, callConstructor 45 | 46 | let getFuncType (args:Type[]) = 47 | if args.Length <= 17 then 48 | Expression.GetFuncType args 49 | else 50 | match args.Length with 51 | | 18 -> typedefof>.MakeGenericType args 52 | | 19 -> typedefof>.MakeGenericType args 53 | | 20 -> typedefof>.MakeGenericType args 54 | | 21 -> typedefof>.MakeGenericType args 55 | | _ -> raise <| NotSupportedException "Quotation expressions with statements or closures containing more then 20 free variables may not be translated in this release of the F# PowerPack. This is due to limitations in the variable binding expression forms available in LINQ expression trees" 56 | 57 | type FuncFSharp<'state,'a> (f:Func<'state,'a>) = 58 | inherit FSharpFunc() 59 | [] val mutable State : 'state 60 | override this.Invoke _ = f.Invoke this.State 61 | 62 | type FuncFSharp<'state,'a,'b> (f:Func<'state,'a,'b>) = 63 | inherit FSharpFunc<'a,'b>() 64 | [] val mutable State : 'state 65 | override this.Invoke a = f.Invoke (this.State,a) 66 | 67 | type FuncFSharp<'state,'a,'b,'c> (f:Func<'state,'a,'b,'c>) = 68 | inherit OptimizedClosures.FSharpFunc<'a,'b,'c>() 69 | [] val mutable State : 'state 70 | override this.Invoke (a,b) = f.Invoke (this.State,a,b) 71 | override this.Invoke a = fun b -> f.Invoke (this.State,a,b) 72 | 73 | type FuncFSharp<'state,'a,'b,'c,'d> (f:Func<'state,'a,'b,'c,'d>) = 74 | inherit OptimizedClosures.FSharpFunc<'a,'b,'c,'d>() 75 | [] val mutable State : 'state 76 | override this.Invoke (a,b,c) = f.Invoke (this.State,a,b,c) 77 | override this.Invoke a = fun b c -> f.Invoke (this.State,a,b,c) 78 | 79 | type FuncFSharp<'state,'a,'b,'c,'d,'e> (f:Func<'state,'a,'b,'c,'d,'e>) = 80 | inherit OptimizedClosures.FSharpFunc<'a,'b,'c,'d,'e>() 81 | [] val mutable State : 'state 82 | override this.Invoke (a,b,c,d) = f.Invoke (this.State,a,b,c,d) 83 | override this.Invoke a = fun b c d -> f.Invoke (this.State,a,b,c,d) 84 | 85 | type FuncFSharp<'state,'a,'b,'c,'d,'e,'f> (f:Func<'state,'a,'b,'c,'d,'e,'f>) = 86 | inherit OptimizedClosures.FSharpFunc<'a,'b,'c,'d,'e,'f>() 87 | [] val mutable State : 'state 88 | override this.Invoke (a,b,c,d,e) = f.Invoke (this.State,a,b,c,d,e) 89 | override this.Invoke a = fun b c d e -> f.Invoke (this.State,a,b,c,d,e) 90 | 91 | type FuncFSharp<'state,'a,'b,'c,'d,'e,'f,'g> (func:Func<'state,'a,'b,'c,'d,'e,'f,'g>) = 92 | inherit OptimizedClosures.FSharpFunc<'a,'b,'c,'d,'e,'f->'g>() 93 | [] val mutable State : 'state 94 | override this.Invoke (a,b,c,d,e) = fun f -> func.Invoke (this.State,a,b,c,d,e,f) 95 | override this.Invoke a = fun b c d e f -> func.Invoke (this.State,a,b,c,d,e,f) 96 | 97 | type FuncFSharp<'state,'a,'b,'c,'d,'e,'f,'g,'h> (func:Func<'state,'a,'b,'c,'d,'e,'f,'g,'h>) = 98 | inherit OptimizedClosures.FSharpFunc<'a,'b,'c,'d,'e,'f->'g->'h>() 99 | [] val mutable State : 'state 100 | override this.Invoke (a,b,c,d,e) = fun f g -> func.Invoke (this.State,a,b,c,d,e,f,g) 101 | override this.Invoke a = fun b c d e f g -> func.Invoke (this.State,a,b,c,d,e,f,g) 102 | 103 | type FuncFSharp<'state,'a,'b,'c,'d,'e,'f,'g,'h,'i> (func:Func<'state,'a,'b,'c,'d,'e,'f,'g,'h,'i>) = 104 | inherit OptimizedClosures.FSharpFunc<'a,'b,'c,'d,'e,'f->'g->'h->'i>() 105 | [] val mutable State : 'state 106 | override this.Invoke (a,b,c,d,e) = fun f g h -> func.Invoke (this.State,a,b,c,d,e,f,g,h) 107 | override this.Invoke a = fun b c d e f g h -> func.Invoke (this.State,a,b,c,d,e,f,g,h) 108 | 109 | type FuncFSharp<'state,'a,'b,'c,'d,'e,'f,'g,'h,'i,'j> (func:Func<'state,'a,'b,'c,'d,'e,'f,'g,'h,'i,'j>) = 110 | inherit OptimizedClosures.FSharpFunc<'a,'b,'c,'d,'e,'f->'g->'h->'i->'j>() 111 | [] val mutable State : 'state 112 | override this.Invoke (a,b,c,d,e) = fun f g h i -> func.Invoke (this.State,a,b,c,d,e,f,g,h,i) 113 | override this.Invoke a = fun b c d e f g h i -> func.Invoke (this.State,a,b,c,d,e,f,g,h,i) 114 | 115 | type FuncFSharp<'state,'a,'b,'c,'d,'e,'f,'g,'h,'i,'j,'k> (func:Func<'state,'a,'b,'c,'d,'e,'f,'g,'h,'i,'j,'k>) = 116 | inherit OptimizedClosures.FSharpFunc<'a,'b,'c,'d,'e,'f->'g->'h->'i->'j->'k>() 117 | [] val mutable State : 'state 118 | override this.Invoke (a,b,c,d,e) = fun f g h i j -> func.Invoke (this.State,a,b,c,d,e,f,g,h,i,j) 119 | override this.Invoke a = fun b c d e f g h i j -> func.Invoke (this.State,a,b,c,d,e,f,g,h,i,j) 120 | 121 | type FuncFSharp<'state,'a,'b,'c,'d,'e,'f,'g,'h,'i,'j,'k,'l> (func:Func<'state,'a,'b,'c,'d,'e,'f,'g,'h,'i,'j,'k,'l>) = 122 | inherit OptimizedClosures.FSharpFunc<'a,'b,'c,'d,'e,'f->'g->'h->'i->'j->'k->'l>() 123 | [] val mutable State : 'state 124 | override this.Invoke (a,b,c,d,e) = fun f g h i j k -> func.Invoke (this.State,a,b,c,d,e,f,g,h,i,j,k) 125 | override this.Invoke a = fun b c d e f g h i j k -> func.Invoke (this.State,a,b,c,d,e,f,g,h,i,j,k) 126 | 127 | type FuncFSharp<'state,'a,'b,'c,'d,'e,'f,'g,'h,'i,'j,'k,'l,'m> (func:Func<'state,'a,'b,'c,'d,'e,'f,'g,'h,'i,'j,'k,'l,'m>) = 128 | inherit OptimizedClosures.FSharpFunc<'a,'b,'c,'d,'e,'f->'g->'h->'i->'j->'k->'l->'m>() 129 | [] val mutable State : 'state 130 | override this.Invoke (a,b,c,d,e) = fun f g h i j k l -> func.Invoke (this.State,a,b,c,d,e,f,g,h,i,j,k,l) 131 | override this.Invoke a = fun b c d e f g h i j k l -> func.Invoke (this.State,a,b,c,d,e,f,g,h,i,j,k,l) 132 | 133 | type FuncFSharp<'state,'a,'b,'c,'d,'e,'f,'g,'h,'i,'j,'k,'l,'m,'n> (func:Func<'state,'a,'b,'c,'d,'e,'f,'g,'h,'i,'j,'k,'l,'m,'n>) = 134 | inherit OptimizedClosures.FSharpFunc<'a,'b,'c,'d,'e,'f->'g->'h->'i->'j->'k->'l->'m->'n>() 135 | [] val mutable State : 'state 136 | override this.Invoke (a,b,c,d,e) = fun f g h i j k l m -> func.Invoke (this.State,a,b,c,d,e,f,g,h,i,j,k,l,m) 137 | override this.Invoke a = fun b c d e f g h i j k l m -> func.Invoke (this.State,a,b,c,d,e,f,g,h,i,j,k,l,m) 138 | 139 | type FuncFSharp<'state,'a,'b,'c,'d,'e,'f,'g,'h,'i,'j,'k,'l,'m,'n,'o> (func:Func<'state,'a,'b,'c,'d,'e,'f,'g,'h,'i,'j,'k,'l,'m,'n,'o>) = 140 | inherit OptimizedClosures.FSharpFunc<'a,'b,'c,'d,'e,'f->'g->'h->'i->'j->'k->'l->'m->'n->'o>() 141 | [] val mutable State : 'state 142 | override this.Invoke (a,b,c,d,e) = fun f g h i j k l m n -> func.Invoke (this.State,a,b,c,d,e,f,g,h,i,j,k,l,m,n) 143 | override this.Invoke a = fun b c d e f g h i j k l m n -> func.Invoke (this.State,a,b,c,d,e,f,g,h,i,j,k,l,m,n) 144 | 145 | type FuncFSharp<'state,'a,'b,'c,'d,'e,'f,'g,'h,'i,'j,'k,'l,'m,'n,'o,'p> (func:Func<'state,'a,'b,'c,'d,'e,'f,'g,'h,'i,'j,'k,'l,'m,'n,'o,'p>) = 146 | inherit OptimizedClosures.FSharpFunc<'a,'b,'c,'d,'e,'f->'g->'h->'i->'j->'k->'l->'m->'n->'o->'p>() 147 | [] val mutable State : 'state 148 | override this.Invoke (a,b,c,d,e) = fun f g h i j k l m n o -> func.Invoke (this.State,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o) 149 | override this.Invoke a = fun b c d e f g h i j k l m n o -> func.Invoke (this.State,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o) 150 | 151 | type FuncFSharp<'state,'a,'b,'c,'d,'e,'f,'g,'h,'i,'j,'k,'l,'m,'n,'o,'p,'q> (func:FuncHelper<'state,'a,'b,'c,'d,'e,'f,'g,'h,'i,'j,'k,'l,'m,'n,'o,'p,'q>) = 152 | inherit OptimizedClosures.FSharpFunc<'a,'b,'c,'d,'e,'f->'g->'h->'i->'j->'k->'l->'m->'n->'o->'p->'q>() 153 | [] val mutable State : 'state 154 | override this.Invoke (a,b,c,d,e) = fun f g h i j k l m n o p -> func.Invoke (this.State,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) 155 | override this.Invoke a = fun b c d e f g h i j k l m n o p -> func.Invoke (this.State,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) 156 | 157 | type FuncFSharp<'state,'a,'b,'c,'d,'e,'f,'g,'h,'i,'j,'k,'l,'m,'n,'o,'p,'q,'r> (func:FuncHelper<'state,'a,'b,'c,'d,'e,'f,'g,'h,'i,'j,'k,'l,'m,'n,'o,'p,'q,'r>) = 158 | inherit OptimizedClosures.FSharpFunc<'a,'b,'c,'d,'e,'f->'g->'h->'i->'j->'k->'l->'m->'n->'o->'p->'q->'r>() 159 | [] val mutable State : 'state 160 | override this.Invoke (a,b,c,d,e) = fun f g h i j k l m n o p q -> func.Invoke (this.State,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q) 161 | override this.Invoke a = fun b c d e f g h i j k l m n o p q -> func.Invoke (this.State,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q) 162 | 163 | type FuncFSharp<'state,'a,'b,'c,'d,'e,'f,'g,'h,'i,'j,'k,'l,'m,'n,'o,'p,'q,'r,'s> (func:FuncHelper<'state,'a,'b,'c,'d,'e,'f,'g,'h,'i,'j,'k,'l,'m,'n,'o,'p,'q,'r,'s>) = 164 | inherit OptimizedClosures.FSharpFunc<'a,'b,'c,'d,'e,'f->'g->'h->'i->'j->'k->'l->'m->'n->'o->'p->'q->'r->'s>() 165 | [] val mutable State : 'state 166 | override this.Invoke (a,b,c,d,e) = fun f g h i j k l m n o p q r -> func.Invoke (this.State,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r) 167 | override this.Invoke a = fun b c d e f g h i j k l m n o p q r -> func.Invoke (this.State,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r) 168 | 169 | type FuncFSharp<'state,'a,'b,'c,'d,'e,'f,'g,'h,'i,'j,'k,'l,'m,'n,'o,'p,'q,'r,'s,'t> (func:FuncHelper<'state,'a,'b,'c,'d,'e,'f,'g,'h,'i,'j,'k,'l,'m,'n,'o,'p,'q,'r,'s,'t>) = 170 | inherit OptimizedClosures.FSharpFunc<'a,'b,'c,'d,'e,'f->'g->'h->'i->'j->'k->'l->'m->'n->'o->'p->'q->'r->'s->'t>() 171 | [] val mutable State : 'state 172 | override this.Invoke (a,b,c,d,e) = fun f g h i j k l m n o p q r s -> func.Invoke (this.State,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s) 173 | override this.Invoke a = fun b c d e f g h i j k l m n o p q r s -> func.Invoke (this.State,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s) 174 | 175 | let getFuncFSharpTypedef varsCount = 176 | match varsCount with 177 | | 1 -> typedefof> 178 | | 2 -> typedefof> 179 | | 3 -> typedefof> 180 | | 4 -> typedefof> 181 | | 5 -> typedefof> 182 | | 6 -> typedefof> 183 | | 7 -> typedefof> 184 | | 8 -> typedefof> 185 | | 9 -> typedefof> 186 | | 10 -> typedefof> 187 | | 11 -> typedefof> 188 | | 12 -> typedefof> 189 | | 13 -> typedefof> 190 | | 14 -> typedefof> 191 | | 15 -> typedefof> 192 | | 16 -> typedefof> 193 | | 17 -> typedefof> 194 | | 18 -> typedefof> 195 | | 19 -> typedefof> 196 | | _ -> raise <| NotSupportedException "Linq expression trees appear unable to compile to delegate that have more generic types" 197 | 198 | [] 199 | type OpRange() = 200 | static let methods = 201 | typeof.GetMethods (BindingFlags.Static ||| BindingFlags.NonPublic) 202 | |> Array.filter (fun ``method`` -> ``method``.Name = "op_Range") 203 | |> Array.map (fun ``method`` -> ``method``.ReturnType.GetGenericArguments().[0], ``method``) 204 | |> dict 205 | 206 | static member TypeProvided ``type`` = methods.ContainsKey ``type`` 207 | static member GetMethod ``type`` = methods.[``type``] 208 | 209 | static member private (..) (lower, upper) : seq = { lower .. upper} 210 | static member private (..) (lower, upper) : seq = { lower .. upper} 211 | static member private (..) (lower, upper) : seq = { lower .. upper} 212 | static member private (..) (lower, upper) : seq = { lower .. upper} 213 | static member private (..) (lower, upper) : seq = { lower .. upper} 214 | static member private (..) (lower, upper) : seq = { lower .. upper} 215 | static member private (..) (lower, upper) : seq = { lower .. upper} 216 | static member private (..) (lower, upper) : seq = { lower .. upper} 217 | static member private (..) (lower, upper) : seq = { lower .. upper} 218 | static member private (..) (lower, upper) : seq = { lower .. upper} 219 | static member private (..) (lower, upper) : seq = { lower .. upper} 220 | static member private (..) (lower, upper) : seq = { lower .. upper} 221 | 222 | [] 223 | type OpRangeStep() = 224 | static let methods = 225 | typeof.GetMethods (BindingFlags.Static ||| BindingFlags.NonPublic) 226 | |> Array.filter (fun ``method`` -> ``method``.Name = "op_RangeStep") 227 | |> Array.map (fun ``method`` -> ``method``.ReturnType.GetGenericArguments().[0], ``method``) 228 | |> dict 229 | 230 | static member TypeProvided ``type`` = methods.ContainsKey ``type`` 231 | static member GetMethod ``type`` = methods.[``type``] 232 | 233 | static member private (.. ..) (lower, incr, upper) : seq = { lower .. incr .. upper} 234 | static member private (.. ..) (lower, incr, upper) : seq = { lower .. incr .. upper} 235 | static member private (.. ..) (lower, incr, upper) : seq = { lower .. incr .. upper} 236 | static member private (.. ..) (lower, incr, upper) : seq = { lower .. incr .. upper} 237 | static member private (.. ..) (lower, incr, upper) : seq = { lower .. incr .. upper} 238 | static member private (.. ..) (lower, incr, upper) : seq = { lower .. incr .. upper} 239 | static member private (.. ..) (lower, incr, upper) : seq = { lower .. incr .. upper} 240 | static member private (.. ..) (lower, incr, upper) : seq = { lower .. incr .. upper} 241 | static member private (.. ..) (lower, incr, upper) : seq = { lower .. incr .. upper} 242 | static member private (.. ..) (lower, incr, upper) : seq = { lower .. incr .. upper} 243 | static member private (.. ..) (lower, incr, upper) : seq = { lower .. incr .. upper} 244 | static member private (.. ..) (lower, incr, upper) : seq = { lower .. incr .. upper} 245 | 246 | let rec getMethodInfo = function 247 | | Patterns.Call(_,``method``,_) -> ``method`` 248 | | Patterns.Lambda(_,body) -> getMethodInfo body 249 | | _ -> failwith "Unexpected Form" 250 | 251 | let getGenericMethodInfo functionExpression = 252 | let methodInfo = getMethodInfo functionExpression 253 | if methodInfo.IsGenericMethod then 254 | methodInfo.GetGenericMethodDefinition () 255 | else 256 | methodInfo 257 | 258 | let ``-> not`` = getGenericMethodInfo <@ not @> 259 | 260 | let ``-> generic=`` = getGenericMethodInfo <@ LanguagePrimitives.GenericEquality @> 261 | let ``-> =`` = getGenericMethodInfo <@ ( = ) @> 262 | let ``-> >`` = getGenericMethodInfo <@ ( > ) @> 263 | let ``-> >=`` = getGenericMethodInfo <@ ( >= ) @> 264 | let ``-> <`` = getGenericMethodInfo <@ ( < ) @> 265 | let ``-> <=`` = getGenericMethodInfo <@ ( <= ) @> 266 | let ``-> <>`` = getGenericMethodInfo <@ ( <> ) @> 267 | 268 | let ``-> ~-`` = getGenericMethodInfo <@ ( ~-) : int -> int @> 269 | let ``-> +`` = getGenericMethodInfo <@ (+) @> 270 | let ``-> /`` = getGenericMethodInfo <@ (/) @> 271 | let ``-> -`` = getGenericMethodInfo <@ (-) @> 272 | let ``-> *`` = getGenericMethodInfo <@ (*) @> 273 | let ``-> %`` = getGenericMethodInfo <@ (%) @> 274 | 275 | let ``-> <<<`` = getGenericMethodInfo <@ (<<<) @> 276 | let ``-> >>>`` = getGenericMethodInfo <@ (>>>) @> 277 | let ``-> &&&`` = getGenericMethodInfo <@ (&&&) @> 278 | let ``-> |||`` = getGenericMethodInfo <@ (|||) @> 279 | let ``-> ^^^`` = getGenericMethodInfo <@ (^^^) @> 280 | let ``-> ~~~`` = getGenericMethodInfo <@ (~~~) @> 281 | 282 | let ``-> checked~-`` = getGenericMethodInfo <@ Checked.(~-) : int -> int @> 283 | let ``-> checked+`` = getGenericMethodInfo <@ Checked.(+) @> 284 | let ``-> checked-`` = getGenericMethodInfo <@ Checked.(-) @> 285 | let ``-> checked*`` = getGenericMethodInfo <@ Checked.(*) @> 286 | 287 | let ``-> char`` = getGenericMethodInfo <@ char @> 288 | let ``-> decimal`` = getGenericMethodInfo <@ decimal @> 289 | let ``-> float`` = getGenericMethodInfo <@ float @> 290 | let ``-> float32`` = getGenericMethodInfo <@ float32 @> 291 | let ``-> sbyte`` = getGenericMethodInfo <@ sbyte @> 292 | let ``-> int16`` = getGenericMethodInfo <@ int16 @> 293 | let ``-> int32`` = getGenericMethodInfo <@ int32 @> 294 | let ``-> int`` = getGenericMethodInfo <@ int @> 295 | let ``-> int64`` = getGenericMethodInfo <@ int64 @> 296 | let ``-> byte`` = getGenericMethodInfo <@ byte @> 297 | let ``-> uint16`` = getGenericMethodInfo <@ uint16 @> 298 | let ``-> uint32`` = getGenericMethodInfo <@ uint32 @> 299 | let ``-> uint64`` = getGenericMethodInfo <@ uint64 @> 300 | 301 | let ``-> checked.char`` = getGenericMethodInfo <@ Checked.char @> 302 | let ``-> checked.sbyte`` = getGenericMethodInfo <@ Checked.sbyte @> 303 | let ``-> checked.int16`` = getGenericMethodInfo <@ Checked.int16 @> 304 | let ``-> checked.int32`` = getGenericMethodInfo <@ Checked.int32 @> 305 | let ``-> checked.int`` = getGenericMethodInfo <@ Checked.int @> 306 | let ``-> checked.int64`` = getGenericMethodInfo <@ Checked.int64 @> 307 | let ``-> checked.byte`` = getGenericMethodInfo <@ Checked.byte @> 308 | let ``-> checked.uint16`` = getGenericMethodInfo <@ Checked.uint16 @> 309 | let ``-> checked.uint32`` = getGenericMethodInfo <@ Checked.uint32 @> 310 | let ``-> checked.uint64`` = getGenericMethodInfo <@ Checked.uint64 @> 311 | 312 | let ``-> getArray`` = getGenericMethodInfo <@ LanguagePrimitives.IntrinsicFunctions.GetArray : int[] -> int -> int @> 313 | let ``-> setArray`` = getGenericMethodInfo <@ LanguagePrimitives.IntrinsicFunctions.SetArray : int[] -> int -> int -> unit @> 314 | 315 | let ``-> id`` = getGenericMethodInfo <@ id @> 316 | let ``-> |>`` = getGenericMethodInfo <@ (|>) @> 317 | let ``-> <|`` = getGenericMethodInfo <@ (<|) @> 318 | let ``-> ..`` = getGenericMethodInfo <@ (..) @> 319 | let ``-> .. ..`` = getGenericMethodInfo <@ (.. ..) @> 320 | 321 | let private languagePrimitivesType = 322 | typedefof<_ list>.Assembly.GetType("Microsoft.FSharp.Core.LanguagePrimitives") 323 | 324 | let private parseInt32M = languagePrimitivesType.GetMethod("ParseInt32") 325 | let private parseInt64M = languagePrimitivesType.GetMethod("ParseInt64") 326 | let private parseUInt32M = languagePrimitivesType.GetMethod("ParseUInt32") 327 | let private parseUInt64M = languagePrimitivesType.GetMethod("ParseUInt64") 328 | 329 | let parseInt32Expr argsP = Expression.Call(null, parseInt32M, argsP) 330 | let parseInt64Expr argsP = Expression.Call(null, parseInt64M, argsP) 331 | let parseUInt32Expr argsP = Expression.Call(null, parseUInt32M, argsP) 332 | let parseUInt64Expr argsP = Expression.Call(null, parseUInt64M, argsP) 333 | 334 | let parseSByteExpr argsP = Expression.Convert(Expression.Call(null, parseInt32M, argsP), typeof) 335 | let parseInt16Expr argsP = Expression.Convert(Expression.Call(null, parseInt32M, argsP), typeof) 336 | let parseByteExpr argsP = Expression.Convert(Expression.Call(null, parseUInt32M, argsP), typeof) 337 | let parseUInt16Expr argsP = Expression.Convert(Expression.Call(null, parseUInt32M, argsP), typeof) 338 | 339 | let private parseSingleM = typeof.GetMethod("Parse", [|typeof; typeof; typeof|]) 340 | let private parseDoubleM = typeof.GetMethod("Parse", [|typeof; typeof; typeof|]) 341 | let private parseDecimalM = typeof.GetMethod("Parse", [|typeof; typeof; typeof|]) 342 | 343 | let private numStyleConst = Expression.Constant(Globalization.NumberStyles.Float) :> Expression 344 | let private providerConst = Expression.Constant(Globalization.CultureInfo.InvariantCulture) :> Expression 345 | 346 | let parseSingleExpr (argsExprs: Expression[]) = 347 | let argsExprs = 348 | [| yield! argsExprs 349 | yield numStyleConst 350 | yield providerConst |] 351 | Expression.Call(null, parseSingleM, argsExprs) 352 | let parseDoubleExpr (argsExprs: Expression[]) = 353 | let argsExprs = 354 | [| yield! argsExprs 355 | yield numStyleConst 356 | yield providerConst |] 357 | Expression.Call(null, parseDoubleM, argsExprs) 358 | let parseDecimalExpr (argsExprs: Expression[]) = 359 | let argsExprs = 360 | [| yield! argsExprs 361 | yield numStyleConst 362 | yield providerConst |] 363 | Expression.Call(null, parseDecimalM, argsExprs) 364 | 365 | let private parseCharM = typeof.GetMethod("Parse") 366 | 367 | let parseCharExpr argsP = Expression.Call(null, parseCharM, argsP) -------------------------------------------------------------------------------- /tests/FSharp.Quotations.Evaluator.Tests/Performance.fs: -------------------------------------------------------------------------------- 1 | module FSharp.Quotations.Evaluator.Performance 2 | 3 | open System 4 | open System.Diagnostics 5 | open System.Reflection 6 | open System.Linq.Expressions 7 | open Xunit 8 | open FSharp.Quotations 9 | open FSharp.Quotations.Evaluator.Unittests 10 | 11 | type TestIterationsAttribute (count) = 12 | inherit Attribute () 13 | member __.Count = count 14 | static member DefaultCount = 10000 15 | 16 | type TimeAllowanceAttribute (multiplier) = 17 | inherit Attribute () 18 | member __.Multiplier = multiplier 19 | static member DefaultMultiplier = 2.0 20 | 21 | let getTypedReflectedDefinition (functionQuotation:Expr<'t>) : MethodInfo * Expr<'t> = 22 | match functionQuotation with 23 | | Patterns.Lambda(_,Patterns.Call(_,``method``,_)) -> 24 | match Expr.TryGetReflectedDefinition ``method`` with 25 | | None -> failwith "Badness" 26 | | Some t -> ``method``, Expr.Cast t 27 | | _ -> failwith "Unexpected Form" 28 | 29 | let getEntryPoints (functionQuotation:Expr't>) = 30 | let ``method``, definition = getTypedReflectedDefinition functionQuotation 31 | 32 | let linqCompiledMethod = definition.Compile () 33 | let directlyCallMethod = Expression.Lambda>(Expression.Call(``method``)).Compile () 34 | 35 | ``method``, linqCompiledMethod, directlyCallMethod 36 | 37 | let testFunction functionQuotation = 38 | let ``method``, compiledMethod, directlyCallMethod = 39 | getEntryPoints functionQuotation 40 | 41 | let viaLinqCompilation = compiledMethod () 42 | let directlyCalled = directlyCallMethod.Invoke () 43 | 44 | check ``method``.Name viaLinqCompilation directlyCalled 45 | 46 | let getIterations (``method``:MethodInfo) = 47 | let testIterations = ``method``.GetCustomAttribute () 48 | if box testIterations = null 49 | then TestIterationsAttribute.DefaultCount 50 | else testIterations.Count 51 | 52 | let getTimeAllowanceMultiplier (``method``:MethodInfo) = 53 | let timeAllowance = ``method``.GetCustomAttribute () 54 | if box timeAllowance = null 55 | then TimeAllowanceAttribute.DefaultMultiplier 56 | else timeAllowance.Multiplier 57 | 58 | //// we probably have a lot of ceremony here for no particular reason, but it shouldn't hurt 59 | let timeFunction functionQuotation = 60 | let ``method``, compiledMethod, directlyCallMethod = 61 | getEntryPoints functionQuotation 62 | 63 | // just run them once to 'prime' them to some degree... 64 | compiledMethod () |> ignore 65 | directlyCallMethod.Invoke () |> ignore 66 | 67 | let iterations = ``method`` |> getIterations 68 | let timeAllowanceMultiplier = ``method`` |> getTimeAllowanceMultiplier 69 | 70 | let getLinqCompiledTime () = 71 | GC.Collect () 72 | System.Threading.Thread.Sleep(1) // start a time slice afresh; maybe! 73 | let sw = Stopwatch.StartNew () 74 | for i=0 to iterations-1 do 75 | compiledMethod () |> ignore 76 | float sw.ElapsedMilliseconds 77 | 78 | let getDirectelyCompiledTime () = 79 | GC.Collect () 80 | System.Threading.Thread.Sleep(1) // start a time slice afresh; maybe! 81 | let sw = Stopwatch.StartNew () 82 | for i=0 to iterations-1 do 83 | directlyCallMethod.Invoke () |> ignore 84 | float sw.ElapsedMilliseconds 85 | 86 | let directMs, viaLinqMs = 87 | // "randomly" choose one to run first 88 | if DateTime.Now.Millisecond / 100 % 2 = 1 then 89 | getDirectelyCompiledTime(), getLinqCompiledTime () 90 | else 91 | let linqCompiledTime = getLinqCompiledTime () 92 | let directelyCompiledTime = getDirectelyCompiledTime () 93 | directelyCompiledTime, linqCompiledTime 94 | 95 | let allowedTime = directMs * timeAllowanceMultiplier 96 | 97 | Assert.True(viaLinqMs <= allowedTime, 98 | sprintf "Took too long! linq=%g compiled=%g multiples of allowed time=%g" 99 | viaLinqMs directMs (viaLinqMs / allowedTime)) 100 | 101 | Assert.True (viaLinqMs >= allowedTime * 0.75, 102 | sprintf "Too fast; decrease the multiplier! linq=%g compiled=%g allowed multiples=%g-%g actual multiples=%g" 103 | viaLinqMs directMs (timeAllowanceMultiplier * 0.75) timeAllowanceMultiplier (viaLinqMs / directMs)) 104 | 105 | #if INCLUDE_TIMING_TESTS 106 | type TimeFactAttribute = FactAttribute 107 | #else 108 | type TimeFactAttribute() = inherit FactAttribute(Skip = "Ignoring timing tests. Set INCLUDE_TIMING_TESTS") 109 | #endif 110 | 111 | [] 112 | let ``[answerDoors](http://rosettacode.org/wiki/100_doors#F.23)`` () = 113 | let ToggleNth n (lst:bool array) = // Toggle every n'th door 114 | [(n-1) .. n .. 99] // For each appropriate door 115 | |> Seq.iter (fun i -> lst.[i] <- not lst.[i]) // toggle it 116 | let doors = Array.create 100 false // Initialize all doors to closed 117 | Seq.iter (fun n -> ToggleNth n doors) [1..100] // toggle the appropriate doors for each pass 118 | doors 119 | 120 | [] 121 | let ``Test [answerDoors](http://rosettacode.org/wiki/100_doors#F.23)`` () = 122 | testFunction <@ ``[answerDoors](http://rosettacode.org/wiki/100_doors#F.23)`` @> 123 | 124 | [] 125 | let ``Time [answerDoors](http://rosettacode.org/wiki/100_doors#F.23)`` () = 126 | timeFunction <@ ``[answerDoors](http://rosettacode.org/wiki/100_doors#F.23)`` @> 127 | 128 | 129 | [] 130 | let ``[answer2](http://rosettacode.org/wiki/100_doors#F.23)`` () = 131 | let PerfectSquare n = 132 | let sqrt = int(Math.Sqrt(float n)) 133 | n = sqrt * sqrt 134 | [| for i in 1..100 do yield PerfectSquare i |] 135 | 136 | [] 137 | let ``Test [answer2](http://rosettacode.org/wiki/100_doors#F.23)`` () = 138 | testFunction <@ ``[answer2](http://rosettacode.org/wiki/100_doors#F.23)`` @> 139 | 140 | [] 141 | let ``Time [answer2](http://rosettacode.org/wiki/100_doors#F.23)`` () = 142 | timeFunction <@ ``[answer2](http://rosettacode.org/wiki/100_doors#F.23)`` @> 143 | 144 | 145 | [] 146 | let ``[Euler_method](http://rosettacode.org/wiki/Euler_method#F.23)`` () = 147 | let euler f (h : float) t0 y0 = 148 | (t0, y0) 149 | |> Seq.unfold (fun (t, y) -> Some((t,y), ((t + h), (y + h * (f t y))))) 150 | 151 | let newtonCoolíng (_:float) y = -0.07 * (y - 20.0) 152 | 153 | let f = newtonCoolíng 154 | let a = 0.0 155 | let y0 = 100.0 156 | let b = 100.0 157 | let h = 10.0 158 | (euler newtonCoolíng h a y0) 159 | |> Seq.takeWhile (fun (t,_) -> t <= b) 160 | |> Seq.toList 161 | 162 | [] 163 | let ``Test [Euler_method](http://rosettacode.org/wiki/Euler_method#F.23)`` () = 164 | testFunction <@ ``[Euler_method](http://rosettacode.org/wiki/Euler_method#F.23)`` @> 165 | 166 | [] 167 | let ``Time [Euler_method](http://rosettacode.org/wiki/Euler_method#F.23)`` () = 168 | timeFunction <@ ``[Euler_method](http://rosettacode.org/wiki/Euler_method#F.23)`` @> 169 | 170 | 171 | [] 172 | let ``int Operators +-/*%`` () = 173 | let rand = Random 3141592 174 | let mutable result = 0 175 | for i = 1 to 10000 do 176 | let mutable x = rand.Next () 177 | x <- x / i 178 | x <- x + i 179 | x <- x * i 180 | x <- x - i 181 | if x % 2 = 1 then 182 | result <- result + 1 183 | result 184 | 185 | [] 186 | let ``Test int Operators +-/*%`` () = 187 | testFunction <@ ``int Operators +-/*%`` @> 188 | 189 | [] 190 | let ``Time int Operators +-/*%`` () = 191 | timeFunction <@ ``int Operators +-/*%`` @> 192 | 193 | 194 | [] 195 | let ``int64 Operators +-/*%`` () = 196 | let rand = Random 3141592 197 | let mutable result = 0L 198 | for i = 1 to 10000 do 199 | let mutable x = int64 <| rand.Next () 200 | let i = int64 i 201 | x <- x / i 202 | x <- x + i 203 | x <- x * i 204 | x <- x - i 205 | if x % 2L = 1L then 206 | result <- result + 1L 207 | result 208 | 209 | [] 210 | let ``Test int64 Operators +-/*%`` () = 211 | testFunction <@ ``int64 Operators +-/*%`` @> 212 | 213 | [] 214 | let ``Time int64 Operators +-/*%`` () = 215 | timeFunction <@ ``int64 Operators +-/*%`` @> 216 | 217 | 218 | [] 219 | let ``float Operators +-/*%`` () = 220 | let rand = Random 3141592 221 | let mutable result = 0.0 222 | for i = 1 to 10000 do 223 | let mutable x = float <| rand.Next () 224 | let i = float i 225 | x <- x / i 226 | x <- x + i 227 | x <- x * i 228 | x <- x - i 229 | if x % 2.0 = 1.0 then 230 | result <- result + 1.0 231 | result 232 | 233 | [] 234 | let ``Test float Operators +-/*%`` () = 235 | testFunction <@ ``float Operators +-/*%`` @> 236 | 237 | [] 238 | let ``Time float Operators +-/*%`` () = 239 | timeFunction <@ ``float Operators +-/*%`` @> 240 | 241 | (* 242 | fails to run compiled version; I think because of FSharp.Core.ExtraTopLevelOperators.ToSingle 243 | 244 | [] 245 | let ``single Operators +-/*%`` () = 246 | let rand = Random 3141592 247 | let mutable result = 0.0 248 | for i = 1 to 10000 do 249 | let mutable x = single <| rand.Next () 250 | let i = single i 251 | x <- x / i 252 | x <- x + i 253 | x <- x * i 254 | x <- x - i 255 | if x % 2.0f = 1.0f then 256 | result <- result + 1.0 257 | result 258 | 259 | [] 260 | let ``Test single Operators +-/*%`` () = 261 | testFunction <@ ``single Operators +-/*%`` @> 262 | 263 | [] 264 | let ``Time single Operators +-/*%`` () = 265 | timeFunction <@ ``single Operators +-/*%`` @> 266 | *) 267 | 268 | 269 | [] 270 | let ``int Operators <>=`` () = 271 | let rand = Random 3141592 272 | let mutable result = 0 273 | for i = 1 to 1000 do 274 | let a = rand.Next () 275 | let b = rand.Next () 276 | let c = rand.Next () 277 | let d = rand.Next () 278 | let e = rand.Next 3 279 | let f = rand.Next 3 280 | let g = rand.Next 3 281 | if a < b then result <- result + 1 282 | if b > c then result <- result - 1 283 | if a >= c then result <- result + 2 284 | if a <= d then result <- result - 2 285 | if e = f then result <- result + 3 286 | if f <> g then result <- result - 3 287 | result 288 | 289 | [] 290 | let ``Test int Operators <>=`` () = 291 | testFunction <@ ``int Operators <>=`` @> 292 | 293 | [] 294 | let ``Time int Operators <>=`` () = 295 | timeFunction <@ ``int Operators <>=`` @> 296 | 297 | 298 | [] 299 | let ``int64 Operators <>=`` () = 300 | let rand = Random 3141592 301 | let mutable result = 0 302 | for i = 1 to 1000 do 303 | let a = rand.Next () 304 | let b = rand.Next () 305 | let c = rand.Next () 306 | let d = rand.Next () 307 | let e = rand.Next 3 308 | let f = rand.Next 3 309 | let g = rand.Next 3 310 | if a < b then result <- result + 1 311 | if b > c then result <- result - 1 312 | if a >= c then result <- result + 2 313 | if a <= d then result <- result - 2 314 | if e = f then result <- result + 3 315 | if f <> g then result <- result - 3 316 | result 317 | 318 | [] 319 | let ``Test int64 Operators <>=`` () = 320 | testFunction <@ ``int64 Operators <>=`` @> 321 | 322 | [] 323 | let ``Time int64 Operators <>=`` () = 324 | timeFunction <@ ``int64 Operators <>=`` @> 325 | 326 | 327 | [] 328 | let ``float Operators <>=`` () = 329 | let rand = Random 3141592 330 | let mutable result = 0 331 | for i = 1 to 1000 do 332 | let a = rand.Next () 333 | let b = rand.Next () 334 | let c = rand.Next () 335 | let d = rand.Next () 336 | let e = rand.Next 3 337 | let f = rand.Next 3 338 | let g = rand.Next 3 339 | if a < b then result <- result + 1 340 | if b > c then result <- result - 1 341 | if a >= c then result <- result + 2 342 | if a <= d then result <- result - 2 343 | if e = f then result <- result + 3 344 | if f <> g then result <- result - 3 345 | result 346 | 347 | [] 348 | let ``Test float Operators <>=`` () = 349 | testFunction <@ ``float Operators <>=`` @> 350 | 351 | [] 352 | let ``Time float Operators <>=`` () = 353 | timeFunction <@ ``float Operators <>=`` @> 354 | 355 | 356 | [] 357 | let ``single Operators <>=`` () = 358 | let rand = Random 3141592 359 | let mutable result = 0 360 | for i = 1 to 1000 do 361 | let a = rand.Next () 362 | let b = rand.Next () 363 | let c = rand.Next () 364 | let d = rand.Next () 365 | let e = rand.Next 3 366 | let f = rand.Next 3 367 | let g = rand.Next 3 368 | if a < b then result <- result + 1 369 | if b > c then result <- result - 1 370 | if a >= c then result <- result + 2 371 | if a <= d then result <- result - 2 372 | if e = f then result <- result + 3 373 | if f <> g then result <- result - 3 374 | result 375 | 376 | [] 377 | let ``Test single Operators <>=`` () = 378 | testFunction <@ ``single Operators <>=`` @> 379 | 380 | [] 381 | let ``Time single Operators <>=`` () = 382 | timeFunction <@ ``single Operators <>=`` @> 383 | 384 | 385 | [] 386 | let ``float cast`` () = 387 | let rand = Random 3141592 388 | let mutable total = 0.0 389 | for i=0 to 1000 do 390 | total <- total + (float (rand.Next ())) 391 | total 392 | 393 | [] 394 | let ``Test float cast`` () = 395 | testFunction <@ ``float cast`` @> 396 | 397 | [] 398 | let ``Time float cast`` () = 399 | timeFunction <@ ``float cast`` @> 400 | 401 | 402 | [] 403 | let ``int64 cast`` () = 404 | let rand = Random 3141592 405 | let mutable total = 0L 406 | for i=0 to 1000 do 407 | total <- total + (int64 (rand.Next ())) 408 | total 409 | 410 | [] 411 | let ``Test int64 cast`` () = 412 | testFunction <@ ``int64 cast`` @> 413 | 414 | [] 415 | let ``Time int64 cast`` () = 416 | timeFunction <@ ``int64 cast`` @> 417 | 418 | 419 | [] 420 | let ``id function`` () = 421 | let rand = Random 3141592 422 | let mutable total = 0 423 | for i = 0 to 1000 do 424 | total <- id (rand.Next ()) 425 | total 426 | 427 | [] 428 | let ``Test id function`` () = 429 | testFunction <@ ``id function`` @> 430 | 431 | [] 432 | let ``Time id function`` () = 433 | timeFunction <@ ``id function`` @> 434 | 435 | 436 | [] 437 | let ``operator |>`` () = 438 | let rand = Random 3141592 439 | let mutable total = 0 440 | for i = 0 to 1000 do 441 | total <- (rand.Next ()) |> id 442 | total 443 | 444 | [] 445 | let ``Test operator |>`` () = 446 | testFunction <@ ``operator |>`` @> 447 | 448 | [] 449 | let ``Time operator |>`` () = 450 | timeFunction <@ ``operator |>`` @> 451 | 452 | 453 | [] 454 | let ``operator <|`` () = 455 | let rand = Random 3141592 456 | let mutable total = 0 457 | for i = 0 to 1000 do 458 | total <- id <| (rand.Next ()) 459 | total 460 | 461 | [] 462 | let ``Test operator <|`` () = 463 | testFunction <@ ``operator <|`` @> 464 | 465 | [] 466 | let ``Time operator <|`` () = 467 | timeFunction <@ ``operator <|`` @> 468 | 469 | [] 470 | let ``operator .. ..`` () = 471 | let mutable n = 0.0 472 | for i in { 1 .. 3 .. 100000 } do 473 | n <- float i 474 | n 475 | 476 | [] 477 | let ``Test operator .. ..`` () = 478 | testFunction <@ ``operator .. ..`` @> 479 | 480 | [] 481 | let ``Time operator .. ..`` () = 482 | timeFunction <@ ``operator .. ..`` @> 483 | 484 | 485 | [] 486 | let ``recursion is even or odd`` () = 487 | let rec isEven n = 488 | if n = 0 then true 489 | else isOdd (n-1) 490 | and isOdd n = 491 | if n = 0 then false 492 | else isEven (n-1) 493 | 494 | let r = Random 3141592 495 | Seq.init 100 (fun _ -> if isEven (r.Next 10000) then 1 else -1) 496 | |> Seq.sum 497 | 498 | [] 499 | let ``Test recursion is even or odd`` () = 500 | testFunction <@ ``recursion is even or odd`` @> 501 | 502 | [] 503 | let ``Time recursion is even or odd`` () = 504 | timeFunction <@ ``recursion is even or odd`` @> 505 | 506 | [] 507 | let ``recursion fibonacci`` () = 508 | let rec fib n = 509 | if n <= 2 then 1 510 | else fib (n-1) + fib (n-2) 511 | 512 | let r = Random 3141592 513 | Seq.init 10 (fun _ -> float <| fib (r.Next 30)) 514 | |> Seq.sum 515 | 516 | [] 517 | let ``Test recursion fibonacci`` () = 518 | testFunction <@ ``recursion fibonacci`` @> 519 | 520 | [] 521 | let ``Time recursion fibonacci`` () = 522 | timeFunction <@ ``recursion fibonacci`` @> 523 | 524 | type Partner = { 525 | Name : string 526 | Partner : Partner 527 | } 528 | 529 | [] 530 | let ``recursion type creation`` () = 531 | let rec penny = { 532 | Name = "Penny" 533 | Partner = paul } 534 | and paul = { 535 | Name = "Paul" 536 | Partner = penny } 537 | 538 | penny.Name + "&" + paul.Name = paul.Partner.Name + "&" + penny.Partner.Name 539 | 540 | [] 541 | let ``Test recursion type creation`` () = 542 | testFunction <@ ``recursion type creation`` @> 543 | 544 | [] 545 | let ``Time recursion type creation`` () = 546 | timeFunction <@ ``recursion type creation`` @> 547 | 548 | 549 | [] 550 | let ``recursion tail`` () = 551 | let rec count acc n = 552 | if n = 0 then acc 553 | else count (acc+1) (n-1) 554 | 555 | count 0 100000 556 | 557 | [] 558 | let ``Test recursion tail`` () = 559 | testFunction <@ ``recursion tail`` @> 560 | 561 | [] 562 | let ``Time recursion tail`` () = 563 | timeFunction <@ ``recursion tail`` @> 564 | 565 | [] 566 | let ``many captures and parameters 1`` () = 567 | let ff a b c d e f = 568 | let gg a' b' c' d' e' f' = 569 | a' * a + b' * b - c' * c + d' * d - e' * e + f' * f 570 | gg 571 | let r = Random 42 572 | let x () = r.Next() 573 | let mutable total = 0 574 | let fff = ff (x()) (x()) (x()) (x()) (x()) (x()) 575 | for i=0 to 10 do 576 | total <- total + fff (x()) (x()) (x()) (x()) (x()) (x()) 577 | total 578 | 579 | [] 580 | let ``Test many captures and parameters 1`` () = 581 | testFunction <@ ``many captures and parameters 1`` @> 582 | 583 | [] 584 | let ``Time many captures and parameters 1`` () = 585 | timeFunction <@ ``many captures and parameters 1`` @> 586 | 587 | [] 588 | let ``many captures and parameters 2`` () = 589 | let ff a b c d e f g h i j k l m n o = 590 | let gg a' = a' * a + a' * b - a' * c + a' * d - a' * e + a' * f - a' * g + a' * h - a' * i + a' * j - a' * k + a' * l - a' * m + a' * n - a' * o 591 | gg 592 | let r = Random 42 593 | let x () = r.Next() 594 | let mutable total = 0 595 | let fff = ff (x()) (x()) (x()) (x()) (x()) (x()) (x()) (x()) (x()) (x()) (x()) (x()) (x()) (x()) (x()) 596 | for i=0 to 10 do 597 | total <- total + fff (x()) 598 | total 599 | 600 | [] 601 | let ``Test many captures and parameters 2`` () = 602 | testFunction <@ ``many captures and parameters 2`` @> 603 | 604 | [] 605 | let ``Time many captures and parameters 2`` () = 606 | timeFunction <@ ``many captures and parameters 2`` @> 607 | 608 | [] 609 | let ``many captures and parameters 3`` () = 610 | let ff a = 611 | let gg a' b' c' d' e' f' g' h' i' j' k' l' m' n' o' p' q' r' s' = 612 | a' * a + b' * a - c' * a + d' * a - e' * a + f' * a - g' * a + h' * a - i' * a + j' * a - k' * a + l' * a - m' * a + n' * a - o' * a + p' * a - q' * a + r' * a - s' * a 613 | gg 614 | let r = Random 42 615 | let x () = r.Next() 616 | let mutable total = 0 617 | let fff = ff (x()) 618 | for i=0 to 10 do 619 | total <- total + fff (x()) (x()) (x()) (x()) (x()) (x()) (x()) (x()) (x()) (x()) (x()) (x()) (x()) (x()) (x()) (x()) (x()) (x()) (x()) 620 | total 621 | 622 | [] 623 | let ``Test many captures and parameters 3`` () = 624 | testFunction <@ ``many captures and parameters 3`` @> 625 | 626 | [] 627 | let ``Time many captures and parameters 3`` () = 628 | timeFunction <@ ``many captures and parameters 3`` @> 629 | 630 | [] 631 | let ``many captures and parameters 4`` () = 632 | let ff a b c d e f g h i j k l m n o = 633 | let gg a' b' c' d' e' f' g' h' i' j' k' l' m' n' o' = 634 | a' * a + b' * b - c' * c + d' * d - e' * e + f' * f - g' * g + h' * h - i' * i + j' * j - k' * k + l' * l - m' * m + n' * n - o' * o 635 | gg 636 | let r = Random 42 637 | let x () = r.Next() 638 | let mutable total = 0 639 | let fff = ff (x()) (x()) (x()) (x()) (x()) (x()) (x()) (x()) (x()) (x()) (x()) (x()) (x()) (x()) (x()) (x()) (x()) (x()) (x()) (x()) (x()) (x()) (x()) (x()) (x()) (x()) 640 | for i=0 to 10 do 641 | total <- total + fff (x()) (x()) (x()) (x()) 642 | total 643 | 644 | [] 645 | let ``Test many captures and parameters 4`` () = 646 | testFunction <@ ``many captures and parameters 4`` @> 647 | 648 | [] 649 | let ``Time many captures and parameters 4`` () = 650 | timeFunction <@ ``many captures and parameters 4`` @> 651 | 652 | 653 | (* 654 | [] 655 | let ``[]()`` () = 656 | 657 | [] 658 | let `` `` () = 659 | testFunction <@ `` `` @> 660 | 661 | [] 662 | let `` `` () = 663 | timeFunction <@ `` `` @> 664 | *) -------------------------------------------------------------------------------- /.paket/Paket.Restore.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | $(MSBuildAllProjects);$(MSBuildThisFileFullPath) 8 | 9 | $(MSBuildVersion) 10 | 15.0.0 11 | false 12 | true 13 | 14 | true 15 | $(MSBuildThisFileDirectory) 16 | $(MSBuildThisFileDirectory)..\ 17 | $(PaketRootPath)paket-files\paket.restore.cached 18 | $(PaketRootPath)paket.lock 19 | classic 20 | proj 21 | assembly 22 | native 23 | /Library/Frameworks/Mono.framework/Commands/mono 24 | mono 25 | 26 | 27 | $(PaketRootPath)paket.bootstrapper.exe 28 | $(PaketToolsPath)paket.bootstrapper.exe 29 | $([System.IO.Path]::GetDirectoryName("$(PaketBootStrapperExePath)"))\ 30 | 31 | "$(PaketBootStrapperExePath)" 32 | $(MonoPath) --runtime=v4.0.30319 "$(PaketBootStrapperExePath)" 33 | 34 | 35 | 36 | 37 | true 38 | true 39 | 40 | 41 | True 42 | 43 | 44 | False 45 | 46 | $(BaseIntermediateOutputPath.TrimEnd('\').TrimEnd('\/')) 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | $(PaketRootPath)paket 56 | $(PaketToolsPath)paket 57 | 58 | 59 | 60 | 61 | 62 | $(PaketRootPath)paket.exe 63 | $(PaketToolsPath)paket.exe 64 | 65 | 66 | 67 | 68 | 69 | <_DotnetToolsJson Condition="Exists('$(PaketRootPath)/.config/dotnet-tools.json')">$([System.IO.File]::ReadAllText("$(PaketRootPath)/.config/dotnet-tools.json")) 70 | <_ConfigContainsPaket Condition=" '$(_DotnetToolsJson)' != ''">$(_DotnetToolsJson.Contains('"paket"')) 71 | <_ConfigContainsPaket Condition=" '$(_ConfigContainsPaket)' == ''">false 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | <_PaketCommand>dotnet paket 83 | 84 | 85 | 86 | 87 | 88 | $(PaketToolsPath)paket 89 | $(PaketBootStrapperExeDir)paket 90 | 91 | 92 | paket 93 | 94 | 95 | 96 | 97 | <_PaketExeExtension>$([System.IO.Path]::GetExtension("$(PaketExePath)")) 98 | <_PaketCommand Condition=" '$(_PaketCommand)' == '' AND '$(_PaketExeExtension)' == '.dll' ">dotnet "$(PaketExePath)" 99 | <_PaketCommand Condition=" '$(_PaketCommand)' == '' AND '$(OS)' != 'Windows_NT' AND '$(_PaketExeExtension)' == '.exe' ">$(MonoPath) --runtime=v4.0.30319 "$(PaketExePath)" 100 | <_PaketCommand Condition=" '$(_PaketCommand)' == '' ">"$(PaketExePath)" 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | true 122 | $(NoWarn);NU1603;NU1604;NU1605;NU1608 123 | false 124 | true 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | $([System.IO.File]::ReadAllText('$(PaketRestoreCacheFile)')) 134 | 135 | 136 | 137 | 138 | 139 | 141 | $([System.Text.RegularExpressions.Regex]::Split(`%(Identity)`, `": "`)[0].Replace(`"`, ``).Replace(` `, ``)) 142 | $([System.Text.RegularExpressions.Regex]::Split(`%(Identity)`, `": "`)[1].Replace(`"`, ``).Replace(` `, ``)) 143 | 144 | 145 | 146 | 147 | %(PaketRestoreCachedKeyValue.Value) 148 | %(PaketRestoreCachedKeyValue.Value) 149 | 150 | 151 | 152 | 153 | true 154 | false 155 | true 156 | 157 | 158 | 162 | 163 | true 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | $(PaketIntermediateOutputPath)\$(MSBuildProjectFile).paket.references.cached 183 | 184 | $(MSBuildProjectFullPath).paket.references 185 | 186 | $(MSBuildProjectDirectory)\$(MSBuildProjectName).paket.references 187 | 188 | $(MSBuildProjectDirectory)\paket.references 189 | 190 | false 191 | true 192 | true 193 | references-file-or-cache-not-found 194 | 195 | 196 | 197 | 198 | $([System.IO.File]::ReadAllText('$(PaketReferencesCachedFilePath)')) 199 | $([System.IO.File]::ReadAllText('$(PaketOriginalReferencesFilePath)')) 200 | references-file 201 | false 202 | 203 | 204 | 205 | 206 | false 207 | 208 | 209 | 210 | 211 | true 212 | target-framework '$(TargetFramework)' or '$(TargetFrameworks)' files @(PaketResolvedFilePaths) 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | false 224 | true 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | $([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',').Length) 236 | $([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[0]) 237 | $([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[1]) 238 | $([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[4]) 239 | $([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[5]) 240 | 241 | 242 | %(PaketReferencesFileLinesInfo.PackageVersion) 243 | All 244 | runtime 245 | runtime 246 | true 247 | true 248 | 249 | 250 | 251 | 252 | $(PaketIntermediateOutputPath)/$(MSBuildProjectFile).paket.clitools 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | $([System.String]::Copy('%(PaketCliToolFileLines.Identity)').Split(',')[0]) 262 | $([System.String]::Copy('%(PaketCliToolFileLines.Identity)').Split(',')[1]) 263 | 264 | 265 | %(PaketCliToolFileLinesInfo.PackageVersion) 266 | 267 | 268 | 269 | 273 | 274 | 275 | 276 | 277 | 278 | false 279 | 280 | 281 | 282 | 283 | 284 | <_NuspecFilesNewLocation Include="$(PaketIntermediateOutputPath)\$(Configuration)\*.nuspec"/> 285 | 286 | 287 | 288 | 289 | 290 | $(MSBuildProjectDirectory)/$(MSBuildProjectFile) 291 | true 292 | false 293 | true 294 | false 295 | true 296 | false 297 | true 298 | false 299 | true 300 | $(PaketIntermediateOutputPath)\$(Configuration) 301 | $(PaketIntermediateOutputPath) 302 | 303 | 304 | 305 | <_NuspecFiles Include="$(AdjustedNuspecOutputPath)\*.$(PackageVersion.Split(`+`)[0]).nuspec"/> 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 363 | 364 | 407 | 408 | 450 | 451 | 492 | 493 | 494 | 495 | -------------------------------------------------------------------------------- /paket.lock: -------------------------------------------------------------------------------- 1 | STORAGE: NONE 2 | RESTRICTION: == netstandard2.0 3 | NUGET 4 | remote: https://api.nuget.org/v3/index.json 5 | FSharp.Core (4.3.1) 6 | Microsoft.Build.Tasks.Git (1.0) - copy_local: true 7 | Microsoft.SourceLink.Common (1.0) - copy_local: true 8 | Microsoft.SourceLink.GitHub (1.0) - copy_local: true 9 | Microsoft.Build.Tasks.Git (>= 1.0) 10 | Microsoft.SourceLink.Common (>= 1.0) 11 | 12 | GROUP Build 13 | GENERATE-LOAD-SCRIPTS: ON 14 | STORAGE: NONE 15 | RESTRICTION: == netstandard2.0 16 | NUGET 17 | remote: https://api.nuget.org/v3/index.json 18 | BlackFox.VsWhere (1.0) 19 | FSharp.Core (>= 4.2.3) 20 | Fake.Core.CommandLineParsing (5.19.1) 21 | FParsec (>= 1.0.3) 22 | FSharp.Core (>= 4.7) 23 | Fake.Core.Context (5.19.1) 24 | FSharp.Core (>= 4.7) 25 | Fake.Core.Environment (5.19.1) 26 | FSharp.Core (>= 4.7) 27 | Fake.Core.FakeVar (5.19.1) 28 | Fake.Core.Context (>= 5.19.1) 29 | FSharp.Core (>= 4.7) 30 | Fake.Core.Process (5.19.1) 31 | Fake.Core.Environment (>= 5.19.1) 32 | Fake.Core.FakeVar (>= 5.19.1) 33 | Fake.Core.String (>= 5.19.1) 34 | Fake.Core.Trace (>= 5.19.1) 35 | Fake.IO.FileSystem (>= 5.19.1) 36 | FSharp.Core (>= 4.7) 37 | System.Diagnostics.Process (>= 4.3) 38 | Fake.Core.ReleaseNotes (5.19.1) 39 | Fake.Core.SemVer (>= 5.19.1) 40 | Fake.Core.String (>= 5.19.1) 41 | FSharp.Core (>= 4.7) 42 | Fake.Core.SemVer (5.19.1) 43 | FSharp.Core (>= 4.7) 44 | System.Runtime.Numerics (>= 4.3) 45 | Fake.Core.String (5.19.1) 46 | FSharp.Core (>= 4.7) 47 | Fake.Core.Target (5.19.1) 48 | Fake.Core.CommandLineParsing (>= 5.19.1) 49 | Fake.Core.Context (>= 5.19.1) 50 | Fake.Core.Environment (>= 5.19.1) 51 | Fake.Core.FakeVar (>= 5.19.1) 52 | Fake.Core.Process (>= 5.19.1) 53 | Fake.Core.String (>= 5.19.1) 54 | Fake.Core.Trace (>= 5.19.1) 55 | FSharp.Control.Reactive (>= 4.2) 56 | FSharp.Core (>= 4.7) 57 | System.Reactive.Compatibility (>= 4.3.1) 58 | Fake.Core.Tasks (5.19.1) 59 | Fake.Core.Trace (>= 5.19.1) 60 | FSharp.Core (>= 4.7) 61 | Fake.Core.Trace (5.19.1) 62 | Fake.Core.Environment (>= 5.19.1) 63 | Fake.Core.FakeVar (>= 5.19.1) 64 | FSharp.Core (>= 4.7) 65 | Fake.Core.UserInput (5.19.1) 66 | FSharp.Core (>= 4.7) 67 | Fake.Core.Xml (5.19.1) 68 | Fake.Core.String (>= 5.19.1) 69 | FSharp.Core (>= 4.7) 70 | System.Xml.ReaderWriter (>= 4.3.1) 71 | System.Xml.XDocument (>= 4.3) 72 | System.Xml.XPath (>= 4.3) 73 | System.Xml.XPath.XDocument (>= 4.3) 74 | System.Xml.XPath.XmlDocument (>= 4.3) 75 | Fake.DotNet.Cli (5.19.1) 76 | Fake.Core.Environment (>= 5.19.1) 77 | Fake.Core.Process (>= 5.19.1) 78 | Fake.Core.String (>= 5.19.1) 79 | Fake.Core.Trace (>= 5.19.1) 80 | Fake.DotNet.MSBuild (>= 5.19.1) 81 | Fake.DotNet.NuGet (>= 5.19.1) 82 | Fake.IO.FileSystem (>= 5.19.1) 83 | FSharp.Core (>= 4.7) 84 | Mono.Posix.NETStandard (>= 1.0) 85 | Newtonsoft.Json (>= 12.0.3) 86 | Fake.DotNet.MSBuild (5.19.1) 87 | BlackFox.VsWhere (>= 1.0) 88 | Fake.Core.Environment (>= 5.19.1) 89 | Fake.Core.Process (>= 5.19.1) 90 | Fake.Core.String (>= 5.19.1) 91 | Fake.Core.Trace (>= 5.19.1) 92 | Fake.IO.FileSystem (>= 5.19.1) 93 | FSharp.Core (>= 4.7) 94 | MSBuild.StructuredLogger (>= 2.0.152) 95 | Fake.DotNet.NuGet (5.19.1) 96 | Fake.Core.Environment (>= 5.19.1) 97 | Fake.Core.Process (>= 5.19.1) 98 | Fake.Core.SemVer (>= 5.19.1) 99 | Fake.Core.String (>= 5.19.1) 100 | Fake.Core.Tasks (>= 5.19.1) 101 | Fake.Core.Trace (>= 5.19.1) 102 | Fake.Core.Xml (>= 5.19.1) 103 | Fake.IO.FileSystem (>= 5.19.1) 104 | Fake.Net.Http (>= 5.19.1) 105 | FSharp.Core (>= 4.7) 106 | Newtonsoft.Json (>= 12.0.3) 107 | NuGet.Protocol (>= 4.9.4) 108 | System.Net.Http (>= 4.3.4) 109 | Fake.IO.FileSystem (5.19.1) 110 | Fake.Core.String (>= 5.19.1) 111 | FSharp.Core (>= 4.7) 112 | System.Diagnostics.FileVersionInfo (>= 4.3) 113 | System.IO.FileSystem.Watcher (>= 4.3) 114 | Fake.Net.Http (5.19.1) 115 | Fake.Core.Trace (>= 5.19.1) 116 | FSharp.Core (>= 4.7) 117 | System.Net.Http (>= 4.3.4) 118 | Fake.Tools.Git (5.19.1) 119 | Fake.Core.Environment (>= 5.19.1) 120 | Fake.Core.Process (>= 5.19.1) 121 | Fake.Core.SemVer (>= 5.19.1) 122 | Fake.Core.String (>= 5.19.1) 123 | Fake.Core.Trace (>= 5.19.1) 124 | Fake.IO.FileSystem (>= 5.19.1) 125 | FSharp.Core (>= 4.7) 126 | FParsec (1.1.1) 127 | FSharp.Core (>= 4.3.4) 128 | FSharp.Compiler.Service (34.1.1) - storage: packages 129 | FSharp.Core (>= 4.6.2) 130 | System.Buffers (>= 4.5) 131 | System.Collections.Immutable (>= 1.5) 132 | System.Diagnostics.Process (>= 4.1) 133 | System.Diagnostics.TraceSource (>= 4.0) 134 | System.Memory (>= 4.5.3) 135 | System.Reflection.Emit (>= 4.3) 136 | System.Reflection.Metadata (>= 1.6) 137 | System.Reflection.TypeExtensions (>= 4.3) 138 | System.Runtime.Loader (>= 4.0) 139 | System.Security.Cryptography.Algorithms (>= 4.3) 140 | FSharp.Control.Reactive (4.2) 141 | FSharp.Core (>= 4.2.3) 142 | System.Reactive (>= 4.0) 143 | FSharp.Core (4.7) 144 | FSharp.Formatting (4.0.0-alpha04) - storage: packages 145 | FSharp.Compiler.Service (>= 34.1) 146 | Microsoft.Build (16.4) 147 | Microsoft.Build.Framework (16.4) 148 | System.Runtime.Serialization.Primitives (>= 4.1.1) 149 | System.Threading.Thread (>= 4.0) 150 | Microsoft.Build.Tasks.Core (16.4) 151 | Microsoft.Build.Framework (>= 16.4) 152 | Microsoft.Build.Utilities.Core (>= 16.4) 153 | Microsoft.Win32.Registry (>= 4.3) 154 | System.CodeDom (>= 4.4) 155 | System.Collections.Immutable (>= 1.5) 156 | System.Linq.Parallel (>= 4.0.1) 157 | System.Net.Http (>= 4.3.4) 158 | System.Reflection.Metadata (>= 1.6) 159 | System.Reflection.TypeExtensions (>= 4.1) 160 | System.Resources.Extensions (>= 4.6) 161 | System.Resources.Writer (>= 4.0) 162 | System.Threading.Tasks.Dataflow (>= 4.9) 163 | Microsoft.Build.Utilities.Core (16.4) 164 | Microsoft.Build.Framework (>= 16.4) 165 | Microsoft.Win32.Registry (>= 4.3) 166 | System.Collections.Immutable (>= 1.5) 167 | System.Text.Encoding.CodePages (>= 4.0.1) 168 | Microsoft.NETCore.Platforms (3.1) 169 | Microsoft.NETCore.Targets (3.1) 170 | Microsoft.Win32.Primitives (4.3) 171 | Microsoft.NETCore.Platforms (>= 1.1) 172 | Microsoft.NETCore.Targets (>= 1.1) 173 | System.Runtime (>= 4.3) 174 | Microsoft.Win32.Registry (4.7) 175 | System.Buffers (>= 4.5) 176 | System.Memory (>= 4.5.3) 177 | System.Security.AccessControl (>= 4.7) 178 | System.Security.Principal.Windows (>= 4.7) 179 | Mono.Posix.NETStandard (1.0) 180 | MSBuild.StructuredLogger (2.0.174) 181 | Microsoft.Build (>= 15.8.166) 182 | Microsoft.Build.Framework (>= 15.8.166) 183 | Microsoft.Build.Tasks.Core (>= 15.8.166) 184 | Microsoft.Build.Utilities.Core (>= 15.8.166) 185 | Newtonsoft.Json (12.0.3) 186 | NuGet.Common (5.4) 187 | NuGet.Frameworks (>= 5.4) 188 | System.Diagnostics.Process (>= 4.3) 189 | System.Threading.Thread (>= 4.3) 190 | NuGet.Configuration (5.4) 191 | NuGet.Common (>= 5.4) 192 | System.Security.Cryptography.ProtectedData (>= 4.3) 193 | NuGet.Frameworks (5.4) 194 | NuGet.Packaging (5.4) 195 | Newtonsoft.Json (>= 9.0.1) 196 | NuGet.Configuration (>= 5.4) 197 | NuGet.Versioning (>= 5.4) 198 | System.Dynamic.Runtime (>= 4.3) 199 | NuGet.Protocol (5.4) 200 | NuGet.Packaging (>= 5.4) 201 | System.Dynamic.Runtime (>= 4.3) 202 | NuGet.Versioning (5.4) 203 | runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) 204 | runtime.debian.9-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) 205 | runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) 206 | runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) 207 | runtime.fedora.27-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) 208 | runtime.fedora.28-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) 209 | runtime.native.System (4.3.1) 210 | Microsoft.NETCore.Platforms (>= 1.1.1) 211 | Microsoft.NETCore.Targets (>= 1.1.3) 212 | runtime.native.System.Net.Http (4.3.1) 213 | Microsoft.NETCore.Platforms (>= 1.1.1) 214 | Microsoft.NETCore.Targets (>= 1.1.3) 215 | runtime.native.System.Security.Cryptography.Apple (4.3.1) - storage: packages 216 | runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple (>= 4.3.1) 217 | runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) 218 | runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) 219 | runtime.debian.9-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) 220 | runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) 221 | runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) 222 | runtime.fedora.27-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) 223 | runtime.fedora.28-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) 224 | runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) 225 | runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) 226 | runtime.opensuse.42.3-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) 227 | runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) 228 | runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) 229 | runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) 230 | runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) 231 | runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) 232 | runtime.ubuntu.18.04-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) 233 | runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) 234 | runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) 235 | runtime.opensuse.42.3-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) 236 | runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple (4.3.1) - storage: packages 237 | runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) 238 | runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) 239 | runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) 240 | runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) 241 | runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) 242 | runtime.ubuntu.18.04-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) 243 | System.Buffers (4.5) - storage: packages 244 | System.CodeDom (4.7) 245 | System.Collections (4.3) 246 | Microsoft.NETCore.Platforms (>= 1.1) 247 | Microsoft.NETCore.Targets (>= 1.1) 248 | System.Runtime (>= 4.3) 249 | System.Collections.Concurrent (4.3) 250 | System.Collections (>= 4.3) 251 | System.Diagnostics.Debug (>= 4.3) 252 | System.Diagnostics.Tracing (>= 4.3) 253 | System.Globalization (>= 4.3) 254 | System.Reflection (>= 4.3) 255 | System.Resources.ResourceManager (>= 4.3) 256 | System.Runtime (>= 4.3) 257 | System.Runtime.Extensions (>= 4.3) 258 | System.Threading (>= 4.3) 259 | System.Threading.Tasks (>= 4.3) 260 | System.Collections.Immutable (1.7) - storage: packages 261 | System.Memory (>= 4.5.3) 262 | System.Diagnostics.Debug (4.3) 263 | Microsoft.NETCore.Platforms (>= 1.1) 264 | Microsoft.NETCore.Targets (>= 1.1) 265 | System.Runtime (>= 4.3) 266 | System.Diagnostics.DiagnosticSource (4.7) 267 | System.Memory (>= 4.5.3) 268 | System.Diagnostics.FileVersionInfo (4.3) 269 | Microsoft.NETCore.Platforms (>= 1.1) 270 | System.Globalization (>= 4.3) 271 | System.IO (>= 4.3) 272 | System.IO.FileSystem (>= 4.3) 273 | System.IO.FileSystem.Primitives (>= 4.3) 274 | System.Reflection.Metadata (>= 1.4.1) 275 | System.Runtime (>= 4.3) 276 | System.Runtime.Extensions (>= 4.3) 277 | System.Runtime.InteropServices (>= 4.3) 278 | System.Diagnostics.Process (4.3) 279 | Microsoft.NETCore.Platforms (>= 1.1) 280 | Microsoft.Win32.Primitives (>= 4.3) 281 | Microsoft.Win32.Registry (>= 4.3) 282 | runtime.native.System (>= 4.3) 283 | System.Collections (>= 4.3) 284 | System.Diagnostics.Debug (>= 4.3) 285 | System.Globalization (>= 4.3) 286 | System.IO (>= 4.3) 287 | System.IO.FileSystem (>= 4.3) 288 | System.IO.FileSystem.Primitives (>= 4.3) 289 | System.Resources.ResourceManager (>= 4.3) 290 | System.Runtime (>= 4.3) 291 | System.Runtime.Extensions (>= 4.3) 292 | System.Runtime.Handles (>= 4.3) 293 | System.Runtime.InteropServices (>= 4.3) 294 | System.Text.Encoding (>= 4.3) 295 | System.Text.Encoding.Extensions (>= 4.3) 296 | System.Threading (>= 4.3) 297 | System.Threading.Tasks (>= 4.3) 298 | System.Threading.Thread (>= 4.3) 299 | System.Threading.ThreadPool (>= 4.3) 300 | System.Diagnostics.Tools (4.3) 301 | Microsoft.NETCore.Platforms (>= 1.1) 302 | Microsoft.NETCore.Targets (>= 1.1) 303 | System.Runtime (>= 4.3) 304 | System.Diagnostics.TraceSource (4.3) - storage: packages 305 | Microsoft.NETCore.Platforms (>= 1.1) 306 | runtime.native.System (>= 4.3) 307 | System.Collections (>= 4.3) 308 | System.Diagnostics.Debug (>= 4.3) 309 | System.Globalization (>= 4.3) 310 | System.Resources.ResourceManager (>= 4.3) 311 | System.Runtime (>= 4.3) 312 | System.Runtime.Extensions (>= 4.3) 313 | System.Threading (>= 4.3) 314 | System.Diagnostics.Tracing (4.3) 315 | Microsoft.NETCore.Platforms (>= 1.1) 316 | Microsoft.NETCore.Targets (>= 1.1) 317 | System.Runtime (>= 4.3) 318 | System.Dynamic.Runtime (4.3) 319 | System.Collections (>= 4.3) 320 | System.Diagnostics.Debug (>= 4.3) 321 | System.Linq (>= 4.3) 322 | System.Linq.Expressions (>= 4.3) 323 | System.ObjectModel (>= 4.3) 324 | System.Reflection (>= 4.3) 325 | System.Reflection.Emit (>= 4.3) 326 | System.Reflection.Emit.ILGeneration (>= 4.3) 327 | System.Reflection.Primitives (>= 4.3) 328 | System.Reflection.TypeExtensions (>= 4.3) 329 | System.Resources.ResourceManager (>= 4.3) 330 | System.Runtime (>= 4.3) 331 | System.Runtime.Extensions (>= 4.3) 332 | System.Threading (>= 4.3) 333 | System.Globalization (4.3) 334 | Microsoft.NETCore.Platforms (>= 1.1) 335 | Microsoft.NETCore.Targets (>= 1.1) 336 | System.Runtime (>= 4.3) 337 | System.Globalization.Calendars (4.3) 338 | Microsoft.NETCore.Platforms (>= 1.1) 339 | Microsoft.NETCore.Targets (>= 1.1) 340 | System.Globalization (>= 4.3) 341 | System.Runtime (>= 4.3) 342 | System.Globalization.Extensions (4.3) 343 | Microsoft.NETCore.Platforms (>= 1.1) 344 | System.Globalization (>= 4.3) 345 | System.Resources.ResourceManager (>= 4.3) 346 | System.Runtime (>= 4.3) 347 | System.Runtime.Extensions (>= 4.3) 348 | System.Runtime.InteropServices (>= 4.3) 349 | System.IO (4.3) 350 | Microsoft.NETCore.Platforms (>= 1.1) 351 | Microsoft.NETCore.Targets (>= 1.1) 352 | System.Runtime (>= 4.3) 353 | System.Text.Encoding (>= 4.3) 354 | System.Threading.Tasks (>= 4.3) 355 | System.IO.FileSystem (4.3) 356 | Microsoft.NETCore.Platforms (>= 1.1) 357 | Microsoft.NETCore.Targets (>= 1.1) 358 | System.IO (>= 4.3) 359 | System.IO.FileSystem.Primitives (>= 4.3) 360 | System.Runtime (>= 4.3) 361 | System.Runtime.Handles (>= 4.3) 362 | System.Text.Encoding (>= 4.3) 363 | System.Threading.Tasks (>= 4.3) 364 | System.IO.FileSystem.Primitives (4.3) 365 | System.Runtime (>= 4.3) 366 | System.IO.FileSystem.Watcher (4.3) 367 | Microsoft.NETCore.Platforms (>= 1.1) 368 | Microsoft.Win32.Primitives (>= 4.3) 369 | runtime.native.System (>= 4.3) 370 | System.Collections (>= 4.3) 371 | System.IO.FileSystem (>= 4.3) 372 | System.IO.FileSystem.Primitives (>= 4.3) 373 | System.Resources.ResourceManager (>= 4.3) 374 | System.Runtime (>= 4.3) 375 | System.Runtime.Extensions (>= 4.3) 376 | System.Runtime.Handles (>= 4.3) 377 | System.Runtime.InteropServices (>= 4.3) 378 | System.Text.Encoding (>= 4.3) 379 | System.Threading (>= 4.3) 380 | System.Threading.Overlapped (>= 4.3) 381 | System.Threading.Tasks (>= 4.3) 382 | System.Threading.Thread (>= 4.3) 383 | System.Linq (4.3) 384 | System.Collections (>= 4.3) 385 | System.Diagnostics.Debug (>= 4.3) 386 | System.Resources.ResourceManager (>= 4.3) 387 | System.Runtime (>= 4.3) 388 | System.Runtime.Extensions (>= 4.3) 389 | System.Linq.Expressions (4.3) 390 | System.Collections (>= 4.3) 391 | System.Diagnostics.Debug (>= 4.3) 392 | System.Globalization (>= 4.3) 393 | System.IO (>= 4.3) 394 | System.Linq (>= 4.3) 395 | System.ObjectModel (>= 4.3) 396 | System.Reflection (>= 4.3) 397 | System.Reflection.Emit (>= 4.3) 398 | System.Reflection.Emit.ILGeneration (>= 4.3) 399 | System.Reflection.Emit.Lightweight (>= 4.3) 400 | System.Reflection.Extensions (>= 4.3) 401 | System.Reflection.Primitives (>= 4.3) 402 | System.Reflection.TypeExtensions (>= 4.3) 403 | System.Resources.ResourceManager (>= 4.3) 404 | System.Runtime (>= 4.3) 405 | System.Runtime.Extensions (>= 4.3) 406 | System.Threading (>= 4.3) 407 | System.Linq.Parallel (4.3) 408 | System.Collections (>= 4.3) 409 | System.Collections.Concurrent (>= 4.3) 410 | System.Diagnostics.Debug (>= 4.3) 411 | System.Diagnostics.Tracing (>= 4.3) 412 | System.Linq (>= 4.3) 413 | System.Resources.ResourceManager (>= 4.3) 414 | System.Runtime (>= 4.3) 415 | System.Runtime.Extensions (>= 4.3) 416 | System.Threading (>= 4.3) 417 | System.Threading.Tasks (>= 4.3) 418 | System.Memory (4.5.3) - storage: packages 419 | System.Buffers (>= 4.4) 420 | System.Numerics.Vectors (>= 4.4) 421 | System.Runtime.CompilerServices.Unsafe (>= 4.5.2) 422 | System.Net.Http (4.3.4) 423 | Microsoft.NETCore.Platforms (>= 1.1.1) 424 | runtime.native.System (>= 4.3) 425 | runtime.native.System.Net.Http (>= 4.3) 426 | runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.2) 427 | System.Collections (>= 4.3) 428 | System.Diagnostics.Debug (>= 4.3) 429 | System.Diagnostics.DiagnosticSource (>= 4.3) 430 | System.Diagnostics.Tracing (>= 4.3) 431 | System.Globalization (>= 4.3) 432 | System.Globalization.Extensions (>= 4.3) 433 | System.IO (>= 4.3) 434 | System.IO.FileSystem (>= 4.3) 435 | System.Net.Primitives (>= 4.3) 436 | System.Resources.ResourceManager (>= 4.3) 437 | System.Runtime (>= 4.3) 438 | System.Runtime.Extensions (>= 4.3) 439 | System.Runtime.Handles (>= 4.3) 440 | System.Runtime.InteropServices (>= 4.3) 441 | System.Security.Cryptography.Algorithms (>= 4.3) 442 | System.Security.Cryptography.Encoding (>= 4.3) 443 | System.Security.Cryptography.OpenSsl (>= 4.3) 444 | System.Security.Cryptography.Primitives (>= 4.3) 445 | System.Security.Cryptography.X509Certificates (>= 4.3) 446 | System.Text.Encoding (>= 4.3) 447 | System.Threading (>= 4.3) 448 | System.Threading.Tasks (>= 4.3) 449 | System.Net.Primitives (4.3.1) 450 | Microsoft.NETCore.Platforms (>= 1.1.1) 451 | Microsoft.NETCore.Targets (>= 1.1.3) 452 | System.Runtime (>= 4.3.1) 453 | System.Runtime.Handles (>= 4.3) 454 | System.Numerics.Vectors (4.5) - storage: packages 455 | System.ObjectModel (4.3) 456 | System.Collections (>= 4.3) 457 | System.Diagnostics.Debug (>= 4.3) 458 | System.Resources.ResourceManager (>= 4.3) 459 | System.Runtime (>= 4.3) 460 | System.Threading (>= 4.3) 461 | System.Reactive (4.3.2) 462 | System.Runtime.InteropServices.WindowsRuntime (>= 4.3) 463 | System.Threading.Tasks.Extensions (>= 4.5.3) 464 | System.Reactive.Compatibility (4.3.2) 465 | System.Reactive.Core (>= 4.3.2) 466 | System.Reactive.Interfaces (>= 4.3.2) 467 | System.Reactive.Linq (>= 4.3.2) 468 | System.Reactive.PlatformServices (>= 4.3.2) 469 | System.Reactive.Providers (>= 4.3.2) 470 | System.Reactive.Core (4.3.2) 471 | System.Reactive (>= 4.3.2) 472 | System.Threading.Tasks.Extensions (>= 4.5.3) 473 | System.Reactive.Interfaces (4.3.2) 474 | System.Reactive (>= 4.3.2) 475 | System.Threading.Tasks.Extensions (>= 4.5.3) 476 | System.Reactive.Linq (4.3.2) 477 | System.Reactive (>= 4.3.2) 478 | System.Threading.Tasks.Extensions (>= 4.5.3) 479 | System.Reactive.PlatformServices (4.3.2) 480 | System.Reactive (>= 4.3.2) 481 | System.Threading.Tasks.Extensions (>= 4.5.3) 482 | System.Reactive.Providers (4.3.2) 483 | System.Reactive (>= 4.3.2) 484 | System.Threading.Tasks.Extensions (>= 4.5.3) 485 | System.Reflection (4.3) 486 | Microsoft.NETCore.Platforms (>= 1.1) 487 | Microsoft.NETCore.Targets (>= 1.1) 488 | System.IO (>= 4.3) 489 | System.Reflection.Primitives (>= 4.3) 490 | System.Runtime (>= 4.3) 491 | System.Reflection.Emit (4.7) - storage: packages 492 | System.Reflection.Emit.ILGeneration (>= 4.7) 493 | System.Reflection.Emit.ILGeneration (4.7) - storage: packages 494 | System.Reflection.Emit.Lightweight (4.7) 495 | System.Reflection.Emit.ILGeneration (>= 4.7) 496 | System.Reflection.Extensions (4.3) 497 | Microsoft.NETCore.Platforms (>= 1.1) 498 | Microsoft.NETCore.Targets (>= 1.1) 499 | System.Reflection (>= 4.3) 500 | System.Runtime (>= 4.3) 501 | System.Reflection.Metadata (1.8) - storage: packages 502 | System.Collections.Immutable (>= 1.7) 503 | System.Reflection.Primitives (4.3) 504 | Microsoft.NETCore.Platforms (>= 1.1) 505 | Microsoft.NETCore.Targets (>= 1.1) 506 | System.Runtime (>= 4.3) 507 | System.Reflection.TypeExtensions (4.7) - storage: packages 508 | System.Resources.Extensions (4.7) 509 | System.Memory (>= 4.5.3) 510 | System.Resources.ResourceManager (4.3) 511 | Microsoft.NETCore.Platforms (>= 1.1) 512 | Microsoft.NETCore.Targets (>= 1.1) 513 | System.Globalization (>= 4.3) 514 | System.Reflection (>= 4.3) 515 | System.Runtime (>= 4.3) 516 | System.Resources.Writer (4.3) 517 | System.Collections (>= 4.3) 518 | System.IO (>= 4.3) 519 | System.Resources.ResourceManager (>= 4.3) 520 | System.Runtime (>= 4.3) 521 | System.Runtime.Extensions (>= 4.3) 522 | System.Text.Encoding (>= 4.3) 523 | System.Runtime (4.3.1) 524 | Microsoft.NETCore.Platforms (>= 1.1.1) 525 | Microsoft.NETCore.Targets (>= 1.1.3) 526 | System.Runtime.CompilerServices.Unsafe (4.7) - storage: packages 527 | System.Runtime.Extensions (4.3.1) 528 | Microsoft.NETCore.Platforms (>= 1.1.1) 529 | Microsoft.NETCore.Targets (>= 1.1.3) 530 | System.Runtime (>= 4.3.1) 531 | System.Runtime.Handles (4.3) 532 | Microsoft.NETCore.Platforms (>= 1.1) 533 | Microsoft.NETCore.Targets (>= 1.1) 534 | System.Runtime (>= 4.3) 535 | System.Runtime.InteropServices (4.3) 536 | Microsoft.NETCore.Platforms (>= 1.1) 537 | Microsoft.NETCore.Targets (>= 1.1) 538 | System.Reflection (>= 4.3) 539 | System.Reflection.Primitives (>= 4.3) 540 | System.Runtime (>= 4.3) 541 | System.Runtime.Handles (>= 4.3) 542 | System.Runtime.InteropServices.WindowsRuntime (4.3) 543 | System.Runtime (>= 4.3) 544 | System.Runtime.Loader (4.3) - storage: packages 545 | System.IO (>= 4.3) 546 | System.Reflection (>= 4.3) 547 | System.Runtime (>= 4.3) 548 | System.Runtime.Numerics (4.3) 549 | System.Globalization (>= 4.3) 550 | System.Resources.ResourceManager (>= 4.3) 551 | System.Runtime (>= 4.3) 552 | System.Runtime.Extensions (>= 4.3) 553 | System.Runtime.Serialization.Primitives (4.3) 554 | System.Resources.ResourceManager (>= 4.3) 555 | System.Runtime (>= 4.3) 556 | System.Security.AccessControl (4.7) 557 | System.Security.Principal.Windows (>= 4.7) 558 | System.Security.Cryptography.Algorithms (4.3.1) - storage: packages 559 | Microsoft.NETCore.Platforms (>= 1.1) 560 | runtime.native.System.Security.Cryptography.Apple (>= 4.3.1) 561 | runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.2) 562 | System.Collections (>= 4.3) 563 | System.IO (>= 4.3) 564 | System.Resources.ResourceManager (>= 4.3) 565 | System.Runtime (>= 4.3) 566 | System.Runtime.Extensions (>= 4.3) 567 | System.Runtime.Handles (>= 4.3) 568 | System.Runtime.InteropServices (>= 4.3) 569 | System.Runtime.Numerics (>= 4.3) 570 | System.Security.Cryptography.Encoding (>= 4.3) 571 | System.Security.Cryptography.Primitives (>= 4.3) 572 | System.Text.Encoding (>= 4.3) 573 | System.Security.Cryptography.Cng (4.7) 574 | System.Security.Cryptography.Csp (4.3) 575 | Microsoft.NETCore.Platforms (>= 1.1) 576 | System.IO (>= 4.3) 577 | System.Reflection (>= 4.3) 578 | System.Resources.ResourceManager (>= 4.3) 579 | System.Runtime (>= 4.3) 580 | System.Runtime.Extensions (>= 4.3) 581 | System.Runtime.Handles (>= 4.3) 582 | System.Runtime.InteropServices (>= 4.3) 583 | System.Security.Cryptography.Algorithms (>= 4.3) 584 | System.Security.Cryptography.Encoding (>= 4.3) 585 | System.Security.Cryptography.Primitives (>= 4.3) 586 | System.Text.Encoding (>= 4.3) 587 | System.Threading (>= 4.3) 588 | System.Security.Cryptography.Encoding (4.3) 589 | Microsoft.NETCore.Platforms (>= 1.1) 590 | runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3) 591 | System.Collections (>= 4.3) 592 | System.Collections.Concurrent (>= 4.3) 593 | System.Linq (>= 4.3) 594 | System.Resources.ResourceManager (>= 4.3) 595 | System.Runtime (>= 4.3) 596 | System.Runtime.Extensions (>= 4.3) 597 | System.Runtime.Handles (>= 4.3) 598 | System.Runtime.InteropServices (>= 4.3) 599 | System.Security.Cryptography.Primitives (>= 4.3) 600 | System.Text.Encoding (>= 4.3) 601 | System.Security.Cryptography.OpenSsl (4.7) 602 | System.Security.Cryptography.Primitives (4.3) 603 | System.Diagnostics.Debug (>= 4.3) 604 | System.Globalization (>= 4.3) 605 | System.IO (>= 4.3) 606 | System.Resources.ResourceManager (>= 4.3) 607 | System.Runtime (>= 4.3) 608 | System.Threading (>= 4.3) 609 | System.Threading.Tasks (>= 4.3) 610 | System.Security.Cryptography.ProtectedData (4.7) 611 | System.Memory (>= 4.5.3) 612 | System.Security.Cryptography.X509Certificates (4.3.2) 613 | Microsoft.NETCore.Platforms (>= 1.1) 614 | runtime.native.System (>= 4.3) 615 | runtime.native.System.Net.Http (>= 4.3) 616 | runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.2) 617 | System.Collections (>= 4.3) 618 | System.Diagnostics.Debug (>= 4.3) 619 | System.Globalization (>= 4.3) 620 | System.Globalization.Calendars (>= 4.3) 621 | System.IO (>= 4.3) 622 | System.IO.FileSystem (>= 4.3) 623 | System.IO.FileSystem.Primitives (>= 4.3) 624 | System.Resources.ResourceManager (>= 4.3) 625 | System.Runtime (>= 4.3) 626 | System.Runtime.Extensions (>= 4.3) 627 | System.Runtime.Handles (>= 4.3) 628 | System.Runtime.InteropServices (>= 4.3) 629 | System.Runtime.Numerics (>= 4.3) 630 | System.Security.Cryptography.Algorithms (>= 4.3) 631 | System.Security.Cryptography.Cng (>= 4.3) 632 | System.Security.Cryptography.Csp (>= 4.3) 633 | System.Security.Cryptography.Encoding (>= 4.3) 634 | System.Security.Cryptography.OpenSsl (>= 4.3) 635 | System.Security.Cryptography.Primitives (>= 4.3) 636 | System.Text.Encoding (>= 4.3) 637 | System.Threading (>= 4.3) 638 | System.Security.Principal.Windows (4.7) 639 | System.Text.Encoding (4.3) 640 | Microsoft.NETCore.Platforms (>= 1.1) 641 | Microsoft.NETCore.Targets (>= 1.1) 642 | System.Runtime (>= 4.3) 643 | System.Text.Encoding.CodePages (4.7) 644 | System.Runtime.CompilerServices.Unsafe (>= 4.7) 645 | System.Text.Encoding.Extensions (4.3) 646 | Microsoft.NETCore.Platforms (>= 1.1) 647 | Microsoft.NETCore.Targets (>= 1.1) 648 | System.Runtime (>= 4.3) 649 | System.Text.Encoding (>= 4.3) 650 | System.Text.RegularExpressions (4.3.1) 651 | System.Collections (>= 4.3) 652 | System.Globalization (>= 4.3) 653 | System.Resources.ResourceManager (>= 4.3) 654 | System.Runtime (>= 4.3.1) 655 | System.Runtime.Extensions (>= 4.3.1) 656 | System.Threading (>= 4.3) 657 | System.Threading (4.3) 658 | System.Runtime (>= 4.3) 659 | System.Threading.Tasks (>= 4.3) 660 | System.Threading.Overlapped (4.3) 661 | Microsoft.NETCore.Platforms (>= 1.1) 662 | System.Resources.ResourceManager (>= 4.3) 663 | System.Runtime (>= 4.3) 664 | System.Runtime.Handles (>= 4.3) 665 | System.Threading.Tasks (4.3) 666 | Microsoft.NETCore.Platforms (>= 1.1) 667 | Microsoft.NETCore.Targets (>= 1.1) 668 | System.Runtime (>= 4.3) 669 | System.Threading.Tasks.Dataflow (4.11) 670 | System.Threading.Tasks.Extensions (4.5.3) 671 | System.Runtime.CompilerServices.Unsafe (>= 4.5.2) 672 | System.Threading.Thread (4.3) 673 | System.Runtime (>= 4.3) 674 | System.Threading.ThreadPool (4.3) 675 | System.Runtime (>= 4.3) 676 | System.Runtime.Handles (>= 4.3) 677 | System.Xml.ReaderWriter (4.3.1) 678 | System.Collections (>= 4.3) 679 | System.Diagnostics.Debug (>= 4.3) 680 | System.Globalization (>= 4.3) 681 | System.IO (>= 4.3) 682 | System.IO.FileSystem (>= 4.3) 683 | System.IO.FileSystem.Primitives (>= 4.3) 684 | System.Resources.ResourceManager (>= 4.3) 685 | System.Runtime (>= 4.3) 686 | System.Runtime.Extensions (>= 4.3) 687 | System.Runtime.InteropServices (>= 4.3) 688 | System.Text.Encoding (>= 4.3) 689 | System.Text.Encoding.Extensions (>= 4.3) 690 | System.Text.RegularExpressions (>= 4.3) 691 | System.Threading.Tasks (>= 4.3) 692 | System.Threading.Tasks.Extensions (>= 4.3) 693 | System.Xml.XDocument (4.3) 694 | System.Collections (>= 4.3) 695 | System.Diagnostics.Debug (>= 4.3) 696 | System.Diagnostics.Tools (>= 4.3) 697 | System.Globalization (>= 4.3) 698 | System.IO (>= 4.3) 699 | System.Reflection (>= 4.3) 700 | System.Resources.ResourceManager (>= 4.3) 701 | System.Runtime (>= 4.3) 702 | System.Runtime.Extensions (>= 4.3) 703 | System.Text.Encoding (>= 4.3) 704 | System.Threading (>= 4.3) 705 | System.Xml.ReaderWriter (>= 4.3) 706 | System.Xml.XmlDocument (4.3) 707 | System.Collections (>= 4.3) 708 | System.Diagnostics.Debug (>= 4.3) 709 | System.Globalization (>= 4.3) 710 | System.IO (>= 4.3) 711 | System.Resources.ResourceManager (>= 4.3) 712 | System.Runtime (>= 4.3) 713 | System.Runtime.Extensions (>= 4.3) 714 | System.Text.Encoding (>= 4.3) 715 | System.Threading (>= 4.3) 716 | System.Xml.ReaderWriter (>= 4.3) 717 | System.Xml.XPath (4.3) 718 | System.Collections (>= 4.3) 719 | System.Diagnostics.Debug (>= 4.3) 720 | System.Globalization (>= 4.3) 721 | System.IO (>= 4.3) 722 | System.Resources.ResourceManager (>= 4.3) 723 | System.Runtime (>= 4.3) 724 | System.Runtime.Extensions (>= 4.3) 725 | System.Threading (>= 4.3) 726 | System.Xml.ReaderWriter (>= 4.3) 727 | System.Xml.XPath.XDocument (4.3) 728 | System.Diagnostics.Debug (>= 4.3) 729 | System.Linq (>= 4.3) 730 | System.Resources.ResourceManager (>= 4.3) 731 | System.Runtime (>= 4.3) 732 | System.Runtime.Extensions (>= 4.3) 733 | System.Threading (>= 4.3) 734 | System.Xml.ReaderWriter (>= 4.3) 735 | System.Xml.XDocument (>= 4.3) 736 | System.Xml.XPath (>= 4.3) 737 | System.Xml.XPath.XmlDocument (4.3) 738 | System.Collections (>= 4.3) 739 | System.Globalization (>= 4.3) 740 | System.IO (>= 4.3) 741 | System.Resources.ResourceManager (>= 4.3) 742 | System.Runtime (>= 4.3) 743 | System.Runtime.Extensions (>= 4.3) 744 | System.Threading (>= 4.3) 745 | System.Xml.ReaderWriter (>= 4.3) 746 | System.Xml.XmlDocument (>= 4.3) 747 | System.Xml.XPath (>= 4.3) 748 | 749 | GROUP Tests 750 | STORAGE: NONE 751 | RESTRICTION: || (== net472) (== netcoreapp3.1) 752 | NUGET 753 | remote: https://api.nuget.org/v3/index.json 754 | FSharp.Core (4.7) 755 | Microsoft.CodeCoverage (16.5) 756 | Microsoft.NET.Test.Sdk (16.5) 757 | Microsoft.CodeCoverage (>= 16.5) 758 | Microsoft.TestPlatform.TestHost (>= 16.5) - restriction: || (&& (== net472) (>= netcoreapp2.1)) (== netcoreapp3.1) 759 | Microsoft.NETCore.Platforms (3.1) - restriction: || (&& (== net472) (< net45)) (&& (== net472) (< net452)) (&& (== net472) (>= netcoreapp2.0)) (&& (== net472) (< netstandard1.0)) (&& (== net472) (< netstandard1.3) (>= wpa81)) (&& (== net472) (< netstandard1.5) (>= uap10.0)) (&& (== net472) (< portable-net45+win8+wpa81)) (&& (== net472) (>= uap10.1)) (&& (== net472) (>= wp8)) (== netcoreapp3.1) 760 | Microsoft.TestPlatform.ObjectModel (16.5) - restriction: || (&& (== net472) (>= netcoreapp2.1)) (== netcoreapp3.1) 761 | NuGet.Frameworks (>= 5.0) 762 | Microsoft.TestPlatform.TestHost (16.5) - restriction: || (&& (== net472) (>= netcoreapp2.1)) (== netcoreapp3.1) 763 | Microsoft.TestPlatform.ObjectModel (>= 16.5) - restriction: || (&& (== net472) (>= netcoreapp2.1)) (&& (== net472) (>= uap10.0)) (== netcoreapp3.1) 764 | Newtonsoft.Json (>= 9.0.1) - restriction: || (&& (== net472) (>= netcoreapp2.1)) (&& (== net472) (>= uap10.0)) (== netcoreapp3.1) 765 | NETStandard.Library (2.0.3) - restriction: || (&& (== net472) (< net452)) (== netcoreapp3.1) 766 | Microsoft.NETCore.Platforms (>= 1.1) 767 | Newtonsoft.Json (12.0.3) - restriction: || (&& (== net472) (>= netcoreapp2.1)) (== netcoreapp3.1) 768 | NuGet.Frameworks (5.4) - restriction: || (&& (== net472) (>= netcoreapp2.1)) (== netcoreapp3.1) 769 | xunit (2.4.1) 770 | xunit.analyzers (>= 0.10) 771 | xunit.assert (2.4.1) 772 | xunit.core (2.4.1) 773 | xunit.abstractions (2.0.3) 774 | xunit.analyzers (0.10) 775 | xunit.assert (2.4.1) 776 | NETStandard.Library (>= 1.6.1) - restriction: || (&& (== net472) (< net452)) (== netcoreapp3.1) 777 | xunit.core (2.4.1) 778 | xunit.extensibility.core (2.4.1) 779 | xunit.extensibility.execution (2.4.1) 780 | xunit.extensibility.core (2.4.1) 781 | NETStandard.Library (>= 1.6.1) - restriction: || (&& (== net472) (< net452)) (== netcoreapp3.1) 782 | xunit.abstractions (>= 2.0.3) 783 | xunit.extensibility.execution (2.4.1) 784 | NETStandard.Library (>= 1.6.1) - restriction: || (&& (== net472) (< net452)) (== netcoreapp3.1) 785 | xunit.extensibility.core (2.4.1) 786 | xunit.runner.visualstudio (2.4.1) 787 | Microsoft.NET.Test.Sdk (>= 15.0) - restriction: || (&& (== net472) (>= netcoreapp1.0)) (== netcoreapp3.1) 788 | -------------------------------------------------------------------------------- /src/FSharp.Quotations.Evaluator/QuotationsEvaluator.fs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation 2005-2008. 2 | // This sample code is provided "as is" without warranty of any kind. 3 | // We disclaim all warranties, either express or implied, including the 4 | // warranties of merchantability and fitness for a particular purpose. 5 | 6 | namespace FSharp.Quotations.Evaluator 7 | 8 | open System 9 | open System.Collections.Generic 10 | open System.Linq.Expressions 11 | open System.Reflection 12 | open FSharp.Reflection 13 | open FSharp.Quotations 14 | open FSharp.Quotations.Patterns 15 | open FSharp.Quotations.DerivedPatterns 16 | open FSharp.Quotations.Evaluator.Tools 17 | 18 | #nowarn "1204" 19 | #nowarn "44" 20 | 21 | module ExtraHashCompare = 22 | let GenericNotEqualIntrinsic<'T> (x:'T) (y:'T) : bool = not (FSharp.Core.LanguagePrimitives.HashCompare.GenericEqualityIntrinsic<'T> x y) 23 | 24 | module QuotationEvaluationTypes = 25 | 26 | type This = 27 | static member Assembly = typeof.Assembly 28 | 29 | let hashCompareType = typeof>.Assembly.GetType("Microsoft.FSharp.Core.LanguagePrimitives+HashCompare") 30 | let extraHashCompareType = This.Assembly.GetType("FSharp.Quotations.Evaluator.ExtraHashCompare") 31 | 32 | let genericEqualityIntrinsic = "GenericEqualityIntrinsic" |> hashCompareType.GetMethod 33 | let genericNotEqualIntrinsic = "GenericNotEqualIntrinsic" |> extraHashCompareType.GetMethod 34 | let genericLessThanIntrinsic = "GenericLessThanIntrinsic" |> hashCompareType.GetMethod 35 | let genericGreaterThanIntrinsic = "GenericGreaterThanIntrinsic" |> hashCompareType.GetMethod 36 | let genericGreaterOrEqualIntrinsic = "GenericGreaterOrEqualIntrinsic" |> hashCompareType.GetMethod 37 | let genericLessOrEqualIntrinsic = "GenericLessOrEqualIntrinsic" |> hashCompareType.GetMethod 38 | 39 | type ConvEnv = { 40 | eraseEquality : bool 41 | varEnv : Map 42 | } 43 | 44 | type ConvResult = 45 | | AsExpression of Expression 46 | | AsLetRecFunction of ParameterExpression * Expression * Expression 47 | // | AsLetRecRecord of ParameterExpression * Expression * Expression 48 | 49 | let asExpr x = AsExpression x 50 | let asExpression x = (x :> Expression) 51 | 52 | let getFunctionType typ = 53 | let isFunctionType typ = 54 | let equivHeadTypes (ty1:Type) (ty2:Type) = 55 | let isNamedType (typ:Type) = 56 | not (typ.IsArray || typ.IsByRef || typ.IsPointer) 57 | 58 | isNamedType(ty1) && 59 | if ty1.IsGenericType then 60 | ty2.IsGenericType && (ty1.GetGenericTypeDefinition()).Equals(ty2.GetGenericTypeDefinition()) 61 | else 62 | ty1.Equals(ty2) 63 | 64 | equivHeadTypes typ (typeof<(int->int)>) 65 | 66 | if not (isFunctionType typ) then 67 | invalidArg "typ" "cannot convert recursion except for function types" 68 | 69 | let tyargs = typ.GetGenericArguments() 70 | tyargs.[0], tyargs.[1] 71 | 72 | let ArrayAssignHelper (arr : 'T[]) (idx:int) (elem:'T) : 'unt = 73 | arr.[idx] <- elem; 74 | unbox (box ()) 75 | 76 | let TryWithHelper e filter handler = 77 | try e() 78 | with e when (filter e <> 0) -> handler e 79 | 80 | let ArrayAssignMethod = match <@@ ArrayAssignHelper @@> with Lambdas(_,Call(_,minfo,_)) -> minfo | _ -> failwith "couldn't find minfo" 81 | let TryWithMethod = match <@@ TryWithHelper @@> with Lambdas(_,Call(_,minfo,_)) -> minfo | _ -> failwith "couldn't find minfo" 82 | 83 | let IsVoidType (ty:System.Type) = (ty = typeof) 84 | 85 | let LinqExpressionHelper (_:'T) : Expression<'T> = failwith "" 86 | let showAll = BindingFlags.Public ||| BindingFlags.NonPublic 87 | 88 | let wrapVoid (e:#Expression) : Expression = 89 | if e.Type <> typeof then e :> _ 90 | else 91 | Expression.Block( 92 | e, 93 | Expression.Constant(null, typeof)) :> _ 94 | 95 | let (|Λ|_|) (``method``:MethodInfo) = function 96 | | Patterns.Call (o, methodInfo, args) when methodInfo.Name = ``method``.Name -> 97 | if methodInfo.IsGenericMethod then 98 | let generic = methodInfo.GetGenericMethodDefinition() 99 | if ``method`` = generic then 100 | let genericArgs = methodInfo.GetGenericArguments () 101 | Some (o, genericArgs, args) 102 | else 103 | None 104 | elif ``method`` = methodInfo then 105 | Some (o, [||], args) 106 | else None 107 | | _ -> None 108 | 109 | let ``-> linqExpressionHelper`` = getGenericMethodInfo <@ LinqExpressionHelper @> 110 | 111 | let (|ArrayTypeQ|_|) (ty:System.Type) = if ty.IsArray && ty.GetArrayRank() = 1 then Some(ty.GetElementType()) else None 112 | 113 | /// Convert F# quotations to LINQ expression trees. 114 | let rec ConvExpr (env:ConvEnv) (inp:Expr) = 115 | match LetRecConvExpr env None inp with 116 | | AsExpression expr -> expr 117 | | _ -> failwith "Invalid logic" 118 | and LetRecConvExpr (env:ConvEnv) (letrec:option) (inp:Expr) = 119 | //printf "ConvExpr : %A\n" e; 120 | match inp with 121 | 122 | // Generic cases 123 | | Patterns.Var(v) -> 124 | try 125 | Map.find v env.varEnv |> asExpr 126 | with 127 | | :? KeyNotFoundException when v.Name = "this" -> 128 | let message = 129 | "Encountered unxpected variable named 'this'. This might happen because " + 130 | "quotations used in queries can’t contain references to let-bound values in classes unless the quotation literal occurs in an instance member. " + 131 | "If this is the case, workaround by replacing references to implicit fields with references to " + 132 | "local variables, e.g. rewrite\r\n" + 133 | " type Foo() =\r\n" + 134 | " let x = 1\r\n" + 135 | " let bar() = <@ x @>\r\n" + 136 | "as: \r\n" + 137 | " type Foo() =\r\n" + 138 | " let x = 1\r\n" + 139 | " let bar() = let x = x in <@ x @>\r\n"; 140 | 141 | raise <| NotSupportedException message 142 | | DerivedPatterns.AndAlso(x1,x2) -> Expression.AndAlso(ConvExpr env x1, ConvExpr env x2) |> asExpr 143 | | DerivedPatterns.OrElse(x1,x2) -> Expression.OrElse(ConvExpr env x1, ConvExpr env x2) |> asExpr 144 | | Patterns.Value(x,ty) -> Expression.Constant(x,ty) |> asExpr 145 | 146 | // REVIEW: exact F# semantics for TypeAs and TypeIs 147 | | Patterns.Coerce(x,toTy) -> Expression.TypeAs(ConvExpr env x,toTy) |> asExpr 148 | | Patterns.TypeTest(x,toTy) -> Expression.TypeIs(ConvExpr env x,toTy) |> asExpr 149 | 150 | // Expr.*Get 151 | | Patterns.FieldGet(objOpt,fieldInfo) -> Expression.Field(ConvObjArg env objOpt None, fieldInfo) |> asExpr 152 | 153 | | Patterns.TupleGet(arg,n) -> 154 | let argP = ConvExpr env arg 155 | let rec build ty argP n = 156 | match Reflection.FSharpValue.PreComputeTuplePropertyInfo(ty,n) with 157 | | propInfo,None -> 158 | Expression.Property(argP, propInfo) |> asExpr 159 | | propInfo,Some(nestedTy,n2) -> 160 | build nestedTy (Expression.Property(argP,propInfo) |> asExpression) n2 161 | build arg.Type argP n 162 | 163 | | Patterns.PropertyGet(objOpt,propInfo,args) -> 164 | let coerceTo = 165 | if objOpt.IsSome && FSharpType.IsUnion propInfo.DeclaringType && FSharpType.IsUnion propInfo.DeclaringType.BaseType then 166 | Some propInfo.DeclaringType 167 | else 168 | None 169 | match args with 170 | | [] -> 171 | Expression.Property(ConvObjArg env objOpt coerceTo, propInfo) |> asExpr 172 | | _ -> 173 | let argsP = ConvExprs env args 174 | Expression.Call(ConvObjArg env objOpt coerceTo, propInfo.GetGetMethod(true),argsP) |> asExpr 175 | 176 | // Expr.*Set 177 | | Patterns.PropertySet(objOpt,propInfo,args,v) -> 178 | let args = (args @ [v]) 179 | let argsP = ConvExprs env args 180 | let minfo = propInfo.GetSetMethod(true) 181 | Expression.Call(ConvObjArg env objOpt None, minfo,argsP) |> wrapVoid |> asExpr 182 | 183 | | Patterns.FieldSet(_,fieldInfo,_) when fieldInfo.IsInitOnly || fieldInfo.IsLiteral -> 184 | raise <| new NotSupportedException("Field-set expressions not supported for readonly or literal fields") 185 | 186 | | Patterns.FieldSet(objOpt,fieldInfo,v) -> 187 | let fieldExpr = Expression.Field(ConvObjArg env objOpt None, fieldInfo) 188 | let vP = ConvExpr env v 189 | let assignment = Expression.Assign(fieldExpr, vP) 190 | Expression.Block(assignment, Expression.Constant((), typeof)) |> asExpr 191 | 192 | // Expr.(Call,Application) 193 | | Patterns.Call(objOpt,minfo,args) -> 194 | let unary x1 f = f (ConvExpr env x1) |> asExpr 195 | let binary x1 x2 f = f (ConvExpr env x1, ConvExpr env x2) |> asExpr 196 | 197 | let convertOrParse (x1: Expr) t parse = 198 | if x1.Type = typeof then 199 | parse (ConvExprs env args) |> asExpr 200 | else 201 | Expression.Convert (ConvExpr env x1, t) |> asExpr 202 | let convertCheckedOrParse (x1: Expr) t parse = 203 | if x1.Type = typeof then 204 | parse (ConvExprs env args) |> asExpr 205 | else 206 | Expression.Convert (ConvExpr env x1, t) |> asExpr 207 | 208 | let transComparison x1 x2 exprConstructor exprErasedConstructor (intrinsic : MethodInfo) = 209 | let e1 = ConvExpr env x1 210 | let e2 = ConvExpr env x2 211 | 212 | let isPrimitive = 213 | let ty = e1.Type 214 | (ty = typeof) || 215 | (ty = typeof) || 216 | (ty = typeof) || 217 | (ty = typeof) || 218 | (ty = typeof) || 219 | (ty = typeof) || 220 | (ty = typeof) || 221 | (ty = typeof) || 222 | (ty = typeof) || 223 | (ty = typeof) || 224 | (ty = typeof) || 225 | (ty = typeof) || 226 | (ty = typeof) || 227 | (ty = typeof) 228 | 229 | if isPrimitive || env.eraseEquality then 230 | exprErasedConstructor(e1,e2) |> asExpr 231 | else 232 | exprConstructor(e1, e2, false, intrinsic.MakeGenericMethod([|x1.Type|])) |> asExpr 233 | 234 | match inp with 235 | | Λ ``-> generic=`` (_,_,[x1;x2]) 236 | | Λ ``-> =`` (_,_,[x1;x2]) -> transComparison x1 x2 Expression.Equal Expression.Equal genericEqualityIntrinsic 237 | | Λ ``-> >`` (_,_,[x1;x2]) -> transComparison x1 x2 Expression.GreaterThan Expression.GreaterThan genericGreaterThanIntrinsic 238 | | Λ ``-> >=`` (_,_,[x1;x2]) -> transComparison x1 x2 Expression.GreaterThanOrEqual Expression.GreaterThanOrEqual genericGreaterOrEqualIntrinsic 239 | | Λ ``-> <`` (_,_,[x1;x2]) -> transComparison x1 x2 Expression.LessThan Expression.LessThan genericLessThanIntrinsic 240 | | Λ ``-> <=`` (_,_,[x1;x2]) -> transComparison x1 x2 Expression.LessThanOrEqual Expression.LessThanOrEqual genericLessOrEqualIntrinsic 241 | | Λ ``-> <>`` (_,_,[x1;x2]) -> transComparison x1 x2 Expression.NotEqual Expression.NotEqual genericNotEqualIntrinsic 242 | 243 | | Λ ``-> not`` (_,_,[x1]) -> unary x1 Expression.Not 244 | | Λ ``-> ~-`` (_,_,[x1]) -> unary x1 Expression.Negate 245 | | Λ ``-> +`` (_,_,[x1;x2]) -> binary x1 x2 Expression.Add 246 | | Λ ``-> /`` (_,_,[x1;x2]) -> binary x1 x2 Expression.Divide 247 | | Λ ``-> -`` (_,_,[x1;x2]) -> binary x1 x2 Expression.Subtract 248 | | Λ ``-> *`` (_,_,[x1;x2]) -> binary x1 x2 Expression.Multiply 249 | | Λ ``-> %`` (_,_,[x1;x2]) -> binary x1 x2 Expression.Modulo 250 | /// REVIEW: basic arithmetic with method witnesses 251 | /// REVIEW: negate,add, divide, multiply, subtract with method witness 252 | 253 | | Λ ``-> <<<`` (_,_,[x1;x2]) -> binary x1 x2 Expression.LeftShift 254 | | Λ ``-> >>>`` (_,_,[x1;x2]) -> binary x1 x2 Expression.RightShift 255 | | Λ ``-> &&&`` (_,_,[x1;x2]) -> binary x1 x2 Expression.And 256 | | Λ ``-> |||`` (_,_,[x1;x2]) -> binary x1 x2 Expression.Or 257 | | Λ ``-> ^^^`` (_,_,[x1;x2]) -> binary x1 x2 Expression.ExclusiveOr 258 | | Λ ``-> ~~~`` (_,_,[x1]) -> unary x1 Expression.Not 259 | /// REVIEW: bitwise operations with method witnesses 260 | 261 | | Λ ``-> checked~-`` (_,_,[x1]) -> unary x1 Expression.NegateChecked 262 | | Λ ``-> checked+`` (_,_,[x1;x2]) -> binary x1 x2 Expression.AddChecked 263 | | Λ ``-> checked-`` (_,_,[x1;x2]) -> binary x1 x2 Expression.SubtractChecked 264 | | Λ ``-> checked*`` (_,_,[x1;x2]) -> binary x1 x2 Expression.MultiplyChecked 265 | 266 | | Λ ``-> char`` (_,_,[x1]) -> convertOrParse x1 typeof parseCharExpr 267 | | Λ ``-> decimal`` (_,_,[x1]) -> convertOrParse x1 typeof parseDecimalExpr 268 | | Λ ``-> float`` (_,_,[x1]) -> convertOrParse x1 typeof parseDoubleExpr 269 | | Λ ``-> float32`` (_,_,[x1]) -> convertOrParse x1 typeof parseSingleExpr 270 | | Λ ``-> sbyte`` (_,_,[x1]) -> convertOrParse x1 typeof parseSByteExpr 271 | | Λ ``-> int16`` (_,_,[x1]) -> convertOrParse x1 typeof parseInt16Expr 272 | | Λ ``-> int32`` (_,_,[x1]) -> convertOrParse x1 typeof parseInt32Expr 273 | | Λ ``-> int`` (_,_,[x1]) -> convertOrParse x1 typeof parseInt32Expr 274 | | Λ ``-> int64`` (_,_,[x1]) -> convertOrParse x1 typeof parseInt64Expr 275 | | Λ ``-> byte`` (_,_,[x1]) -> convertOrParse x1 typeof parseByteExpr 276 | | Λ ``-> uint16`` (_,_,[x1]) -> convertOrParse x1 typeof parseUInt16Expr 277 | | Λ ``-> uint32`` (_,_,[x1]) -> convertOrParse x1 typeof parseUInt32Expr 278 | | Λ ``-> uint64`` (_,_,[x1]) -> convertOrParse x1 typeof parseUInt64Expr 279 | /// REVIEW: convert with method witness 280 | 281 | | Λ ``-> checked.char`` (_,_,[x1]) -> convertCheckedOrParse x1 typeof parseCharExpr 282 | | Λ ``-> checked.sbyte`` (_,_,[x1]) -> convertCheckedOrParse x1 typeof parseSByteExpr 283 | | Λ ``-> checked.int16`` (_,_,[x1]) -> convertCheckedOrParse x1 typeof parseInt16Expr 284 | | Λ ``-> checked.int32`` (_,_,[x1]) -> convertCheckedOrParse x1 typeof parseInt32Expr 285 | | Λ ``-> checked.int`` (_,_,[x1]) -> convertCheckedOrParse x1 typeof parseInt32Expr 286 | | Λ ``-> checked.int64`` (_,_,[x1]) -> convertCheckedOrParse x1 typeof parseInt64Expr 287 | | Λ ``-> checked.byte`` (_,_,[x1]) -> convertCheckedOrParse x1 typeof parseByteExpr 288 | | Λ ``-> checked.uint16`` (_,_,[x1]) -> convertCheckedOrParse x1 typeof parseUInt16Expr 289 | | Λ ``-> checked.uint32`` (_,_,[x1]) -> convertCheckedOrParse x1 typeof parseUInt32Expr 290 | | Λ ``-> checked.uint64`` (_,_,[x1]) -> convertCheckedOrParse x1 typeof parseUInt64Expr 291 | 292 | | Λ ``-> getArray`` (_, [|ArrayTypeQ(_elemTy);_;_|],[x1;x2]) -> 293 | Expression.ArrayIndex(ConvExpr env x1, ConvExpr env x2) |> asExpr 294 | 295 | | Λ ``-> setArray`` (_, [|ArrayTypeQ(elemTy);_;_|],[arr;idx;elem]) -> 296 | let minfo = ArrayAssignMethod.GetGenericMethodDefinition().MakeGenericMethod [| elemTy;typeof |] 297 | Expression.Call(minfo,[| ConvExpr env arr; ConvExpr env idx; ConvExpr env elem |]) |> asExpr 298 | 299 | // Throw away markers inserted to satisfy C#'s design where they pass an argument 300 | // or type T to an argument expecting Expr. 301 | | Λ ``-> linqExpressionHelper`` (_, [|_|],[x1]) -> LetRecConvExpr env letrec x1 302 | 303 | /// ArrayLength 304 | /// ListBind 305 | /// ListInit 306 | /// ElementInit 307 | | _ -> 308 | let argsP = ConvExprs env args 309 | Expression.Call(ConvObjArg env objOpt None, minfo, argsP) |> wrapVoid |> asExpr 310 | 311 | // f x1 x2 x3 x4 --> InvokeFast4 312 | | Patterns.Application(Patterns.Application(Patterns.Application(Patterns.Application(f,arg1),arg2),arg3),arg4) -> 313 | let domainTy1, rangeTy = getFunctionType f.Type 314 | let domainTy2, rangeTy = getFunctionType rangeTy 315 | let domainTy3, rangeTy = getFunctionType rangeTy 316 | let domainTy4, rangeTy = getFunctionType rangeTy 317 | let (-->) ty1 ty2 = Reflection.FSharpType.MakeFunctionType(ty1,ty2) 318 | let ty = domainTy1 --> domainTy2 319 | let meth = (ty.GetMethods() |> Array.find (fun minfo -> minfo.Name = "InvokeFast" && minfo.GetParameters().Length = 5)).MakeGenericMethod [| domainTy3; domainTy4; rangeTy |] 320 | let argsP = ConvExprs env [f; arg1;arg2;arg3; arg4] 321 | Expression.Call((null:Expression), meth, argsP) |> asExpr 322 | 323 | // f x1 x2 x3 --> InvokeFast3 324 | | Patterns.Application(Patterns.Application(Patterns.Application(f,arg1),arg2),arg3) -> 325 | let domainTy1, rangeTy = getFunctionType f.Type 326 | let domainTy2, rangeTy = getFunctionType rangeTy 327 | let domainTy3, rangeTy = getFunctionType rangeTy 328 | let (-->) ty1 ty2 = Reflection.FSharpType.MakeFunctionType(ty1,ty2) 329 | let ty = domainTy1 --> domainTy2 330 | let meth = (ty.GetMethods() |> Array.find (fun minfo -> minfo.Name = "InvokeFast" && minfo.GetParameters().Length = 4)).MakeGenericMethod [| domainTy3; rangeTy |] 331 | let argsP = ConvExprs env [f; arg1;arg2;arg3] 332 | Expression.Call((null:Expression), meth, argsP) |> asExpr 333 | 334 | // f x1 x2 --> InvokeFast2 335 | | Patterns.Application(Patterns.Application(f,arg1),arg2) -> 336 | let domainTy1, rangeTy = getFunctionType f.Type 337 | let domainTy2, rangeTy = getFunctionType rangeTy 338 | let (-->) ty1 ty2 = Reflection.FSharpType.MakeFunctionType(ty1,ty2) 339 | let ty = domainTy1 --> domainTy2 340 | let meth = (ty.GetMethods() |> Array.find (fun minfo -> minfo.Name = "InvokeFast" && minfo.GetParameters().Length = 3)).MakeGenericMethod [| rangeTy |] 341 | let argsP = ConvExprs env [f; arg1;arg2] 342 | Expression.Call((null:Expression), meth, argsP) |> asExpr 343 | 344 | // f x1 --> Invoke 345 | | Patterns.Application(f,arg) -> 346 | let fP = ConvExpr env f 347 | let argP = ConvExpr env arg 348 | let meth = f.Type.GetMethod("Invoke") 349 | Expression.Call(fP, meth, [| argP |]) |> asExpr 350 | 351 | // Expr.New* 352 | | Patterns.NewRecord(recdTy,args) -> 353 | let ctorInfo = Reflection.FSharpValue.PreComputeRecordConstructorInfo(recdTy,showAll) 354 | Expression.New(ctorInfo,ConvExprs env args) |> asExpr 355 | 356 | | Patterns.NewArray(ty,args) -> 357 | Expression.NewArrayInit(ty,ConvExprs env args) |> asExpr 358 | 359 | | Patterns.DefaultValue(ty) -> 360 | Expression.New(ty) |> asExpr 361 | 362 | | Patterns.NewUnionCase(unionCaseInfo,args) -> 363 | let methInfo = Reflection.FSharpValue.PreComputeUnionConstructorInfo(unionCaseInfo,showAll) 364 | let argsR = ConvExprs env args 365 | Expression.Call((null:Expression),methInfo,argsR) |> asExpr 366 | 367 | | Patterns.UnionCaseTest(e,unionCaseInfo) -> 368 | let methInfo = Reflection.FSharpValue.PreComputeUnionTagMemberInfo(unionCaseInfo.DeclaringType,showAll) 369 | let obj = ConvExpr env e 370 | let tagE = 371 | match methInfo with 372 | | :? PropertyInfo as p -> 373 | Expression.Property(obj,p) |> asExpression 374 | | :? MethodInfo as m -> 375 | Expression.Call((null:Expression),m,[| obj |]) |> asExpression 376 | | _ -> failwith "unreachable case" 377 | Expression.Equal(tagE, Expression.Constant(unionCaseInfo.Tag)) |> asExpr 378 | 379 | | Patterns.NewObject(ctorInfo,args) -> 380 | Expression.New(ctorInfo,ConvExprs env args) |> asExpr 381 | 382 | | Patterns.NewDelegate(dty,vs,b) -> 383 | let vsP = List.map ConvVar vs 384 | let env = {env with varEnv = List.foldBack2 (fun (v:Var) vP -> Map.add v (vP |> asExpression)) vs vsP env.varEnv } 385 | let bodyP = ConvExpr env b 386 | Expression.Lambda(dty, bodyP, vsP) |> asExpr 387 | 388 | | Patterns.NewTuple(args) -> 389 | let tupTy = args |> List.map (fun arg -> arg.Type) |> Array.ofList |> Reflection.FSharpType.MakeTupleType 390 | let argsP = ConvExprs env args 391 | let rec build ty (argsP: Expression[]) = 392 | match Reflection.FSharpValue.PreComputeTupleConstructorInfo(ty) with 393 | | ctorInfo,None -> Expression.New(ctorInfo,argsP) |> asExpression 394 | | ctorInfo,Some(nestedTy) -> 395 | let n = ctorInfo.GetParameters().Length - 1 396 | Expression.New(ctorInfo, Array.append argsP.[0..n-1] [| build nestedTy argsP.[n..] |]) |> asExpression 397 | build tupTy argsP |> asExpr 398 | 399 | | Patterns.IfThenElse(g,t,e) -> 400 | Expression.Condition(ConvExpr env g, ConvExpr env t,ConvExpr env e) |> asExpr 401 | 402 | | Patterns.Sequential (e1,e2) -> 403 | let e1P = ConvExpr env e1 404 | let e2P = ConvExpr env e2 405 | Expression.Block(e1P, e2P) |> asExpr 406 | 407 | | Patterns.Let (v,e,b) -> 408 | let vP = Expression.Variable (v.Type, v.Name) 409 | let eP = ConvExpr env e 410 | let assign = Expression.Assign (vP, eP) |> asExpression 411 | 412 | let env = { env with varEnv = env.varEnv |> Map.add v (vP |> asExpression) } 413 | let bodyP = ConvExpr env b 414 | 415 | Expression.Block ([vP], [assign; bodyP]) |> asExpr 416 | 417 | | Patterns.VarSet (variable, value) -> 418 | let linqVariable = Map.find variable env.varEnv 419 | let linqValue = ConvExpr env value 420 | let assignment = Expression.Assign (linqVariable, linqValue) 421 | Expression.Block(assignment, Expression.Constant((), typeof)) |> asExpr 422 | 423 | | Patterns.Lambda (firstVar, firstBody) as lambda -> 424 | let rec getArguments args maybeBody = function 425 | | Lambda (v, body) -> getArguments (v::args) (Some body) body 426 | | _ -> List.rev args, maybeBody.Value 427 | 428 | let arguments, body = 429 | getArguments [] None lambda 430 | 431 | let capturedVars = 432 | let parameterVars = Set arguments 433 | 434 | body.GetFreeVars () 435 | |> Seq.filter (fun freeVar -> not <| Set.contains freeVar parameterVars) 436 | |> Seq.sortBy (fun freeVar -> freeVar.Name) 437 | |> Seq.toList 438 | 439 | let argsCount = arguments.Length 440 | if argsCount > 19 then 441 | // due to limitations of compiling linq quotations we have this fallback where we just pop 442 | // off a single argument and try again. This gives very poor runtime performance, but I'm 443 | // guessing (hoping?) that there aren't too many real world functions that have > 19 arguments. 444 | let v, body = firstVar, firstBody 445 | 446 | let vP = ConvVar v 447 | let env = { env with varEnv = Map.add v (vP |> asExpression) env.varEnv } 448 | let tyargs = [| v.Type; body.Type |] 449 | let bodyP = ConvExpr env body 450 | let convType = typedefof>.MakeGenericType tyargs 451 | let convDelegate = Expression.Lambda(convType, bodyP, [| vP |]) |> asExpression 452 | Expression.Call(typeof,"ToFSharpFunc",tyargs,[| convDelegate |]) |> asExpr 453 | else 454 | let stateType, makeStateConstructor = 455 | match capturedVars |> List.map (fun v -> v.Type) |> List.toArray with 456 | | [|t|] -> t, (fun x -> Seq.head x) 457 | | types -> createGenericTupleType types 458 | 459 | let stateParameter = 460 | Expression.Parameter (stateType, "capturedState") 461 | 462 | let stateEnvironment = 463 | match capturedVars with 464 | | v1 :: [] -> [v1, stateParameter |> asExpression] 465 | | _ -> List.mapi (fun idx var -> var, getExpressionFromTuple stateParameter idx) capturedVars 466 | 467 | let varParameters = 468 | arguments 469 | |> List.map (fun var -> var, Expression.Parameter (var.Type, var.Name)) 470 | 471 | let lambdaEnv = 472 | { env with 473 | varEnv = 474 | let environmentVariables = 475 | varParameters 476 | |> List.map (fun (v,p) -> v, p |> asExpression) 477 | |> List.append stateEnvironment 478 | 479 | (env.varEnv, environmentVariables) 480 | ||> List.fold (fun varEnv (var, parameter) -> 481 | varEnv 482 | |> Map.add var parameter) } 483 | 484 | let linqBody = 485 | let rawLinqBody = ConvExpr lambdaEnv body |> wrapVoid 486 | 487 | let fsharpFuncType = typedefof<_->_> 488 | let rec tryFindfsharpFuncParent = function 489 | | null -> None 490 | | (t:Type) -> 491 | if t.IsGenericType && fsharpFuncType.Equals (t.GetGenericTypeDefinition ()) 492 | then Some t 493 | else tryFindfsharpFuncParent t.BaseType 494 | 495 | match tryFindfsharpFuncParent rawLinqBody.Type with 496 | | None -> rawLinqBody 497 | | Some fsharpFuncType -> Expression.Convert (rawLinqBody, fsharpFuncType) :> Expression 498 | 499 | let parameters = 500 | [ yield stateParameter 501 | yield! varParameters |> List.map snd ] 502 | 503 | let funcTypes = 504 | [| yield! parameters |> List.map (fun p -> p.Type ) 505 | yield linqBody.Type |] 506 | 507 | let linqLambda = Expression.Lambda (getFuncType funcTypes, linqBody, parameters) 508 | 509 | let ``function`` = linqLambda.Compile () 510 | 511 | let funcFSharp = 512 | getFuncFSharpTypedef argsCount 513 | 514 | let parameterTypes = 515 | [| yield stateType 516 | yield! varParameters |> List.map (fun (vars,_) -> vars.Type) 517 | yield linqBody.Type |] 518 | 519 | let ``type`` = funcFSharp.MakeGenericType parameterTypes 520 | 521 | let ``constructor`` = ``type``.GetConstructor [| ``function``.GetType () |] 522 | 523 | let theFuncObject = Expression.Variable (``type``, "funcObject") 524 | 525 | match capturedVars with 526 | | [] -> 527 | let obj = ``constructor``.Invoke [| ``function`` |] 528 | Expression.Constant obj |> asExpr 529 | | _ -> 530 | let newObject = 531 | Expression.New ( 532 | ``constructor``, 533 | [Expression.Constant(``function``) |> asExpression]) 534 | 535 | let state = 536 | let getVar var = 537 | if Some var = letrec 538 | then theFuncObject |> asExpression 539 | else Map.find var env.varEnv 540 | 541 | match capturedVars with 542 | | v1 :: [] -> getVar v1 543 | | _ -> 544 | capturedVars 545 | |> List.map getVar 546 | |> makeStateConstructor 547 | 548 | let assignToConstruction = 549 | Expression.Assign( 550 | theFuncObject, 551 | newObject) |> asExpression; 552 | 553 | let assignState = 554 | Expression.Assign( 555 | Expression.PropertyOrField(theFuncObject, "State"), 556 | state) |> asExpression; 557 | 558 | if letrec.IsSome then 559 | AsLetRecFunction (theFuncObject, assignToConstruction, assignState) 560 | else 561 | Expression.Block ( 562 | [ theFuncObject ], 563 | [ 564 | assignToConstruction; 565 | assignState; 566 | theFuncObject |> asExpression 567 | ]) |> asExpr 568 | 569 | | Patterns.WhileLoop(condition, iteration) -> 570 | let linqCondition = ConvExpr env condition 571 | let linqIteration = ConvExpr env iteration 572 | 573 | let breakLabel = Expression.Label () 574 | let linqLoop = 575 | Expression.Loop ( 576 | Expression.Block ( 577 | Expression.IfThenElse ( 578 | linqCondition, 579 | linqIteration, 580 | Expression.Break breakLabel)), 581 | breakLabel) 582 | 583 | linqLoop |> wrapVoid |> asExpr 584 | 585 | | Patterns.ForIntegerRangeLoop(indexer, lowerValue, upperValue, iteration) -> 586 | let linqLowerValue = ConvExpr env lowerValue 587 | let linqUpperValue = ConvExpr env upperValue 588 | let linqIndexer = Expression.Variable (linqLowerValue.Type, indexer.Name) 589 | let linqAssignLower = Expression.Assign (linqIndexer, linqLowerValue) 590 | let linqCondition = Expression.LessThanOrEqual (linqIndexer, linqUpperValue) 591 | 592 | let envInner = { env with varEnv = Map.add indexer (linqIndexer |> asExpression) env.varEnv } 593 | 594 | let linqIteration = 595 | Expression.Block ( 596 | ConvExpr envInner iteration, 597 | Expression.Assign(linqIndexer, Expression.Increment (linqIndexer))) 598 | 599 | let breakLabel = Expression.Label () 600 | let linqLoop = 601 | Expression.Loop ( 602 | Expression.Block ( 603 | Expression.IfThenElse ( 604 | linqCondition, 605 | linqIteration, 606 | Expression.Break breakLabel)), 607 | breakLabel) 608 | 609 | let linqStatements = 610 | Expression.Block ( 611 | [linqIndexer], 612 | [linqAssignLower |> asExpression; linqLoop |> asExpression] 613 | ) 614 | 615 | linqStatements |> asExpr 616 | 617 | | Patterns.TryFinally(e,h) -> 618 | let eP = ConvExpr env e 619 | let hP = ConvExpr env h 620 | Expression.TryFinally(eP, hP) |> asExpr 621 | 622 | | Patterns.TryWith(e,vf,filter,vh,handler) -> 623 | let eP = ConvExpr env (Expr.Lambda(new Var("unitVar",typeof), e)) 624 | let filterP = ConvExpr env (Expr.Lambda(vf,filter)) 625 | let handlerP = ConvExpr env (Expr.Lambda(vh,handler)) 626 | let minfo = TryWithMethod.GetGenericMethodDefinition().MakeGenericMethod [| e.Type |] 627 | Expression.Call(minfo,[| eP; filterP; handlerP |]) |> asExpr 628 | 629 | | Patterns.LetRecursive (binds, body) -> 630 | let variablesAsLinq = 631 | binds 632 | |> List.map (fun (v, e) -> 633 | v, Expression.Variable (v.Type, v.Name), e) 634 | 635 | let env = { 636 | env with 637 | varEnv = 638 | (env.varEnv, variablesAsLinq) 639 | ||> List.fold (fun varEnv (v,vP,_) -> 640 | varEnv 641 | |> Map.add v (vP |> asExpression)) } 642 | 643 | let bindingAsLinq = 644 | variablesAsLinq 645 | |> List.map (fun (v, vP, e) -> vP, LetRecConvExpr env (Some v) e) 646 | 647 | let nonRecursiveBindings = 648 | bindingAsLinq 649 | |> List.choose (function 650 | | vP, AsExpression e -> Some (vP, Expression.Assign(vP, e) |> asExpression) 651 | | _ -> None) 652 | 653 | let nonRecursiveAssignments = 654 | nonRecursiveBindings 655 | |> List.map snd 656 | 657 | let variables = 658 | nonRecursiveBindings 659 | |> List.map fst 660 | 661 | let recursiveFunctionBindings = 662 | bindingAsLinq 663 | |> List.choose (function 664 | | vP, AsLetRecFunction (funcObject, assignToFuncObject, assignState) -> 665 | Some (vP, funcObject, assignToFuncObject, assignState) 666 | | _ -> None) 667 | 668 | let variables = 669 | recursiveFunctionBindings 670 | |> List.collect (fun (v,fo,_,_) -> [ v; fo ]) 671 | |> List.append variables 672 | 673 | let assignToLocalObject = 674 | recursiveFunctionBindings 675 | |> List.map (fun (_,_,assignToFuncObject,_) -> assignToFuncObject) 676 | 677 | let assignToFuncObject = 678 | recursiveFunctionBindings 679 | |> List.map (fun (vP, funcObject, _,_) -> 680 | Expression.Assign (vP, funcObject) |> asExpression) 681 | 682 | let assignState = 683 | recursiveFunctionBindings 684 | |> List.map (fun (_,_,_, assignState) -> assignState) 685 | 686 | let bodyP = ConvExpr env body 687 | 688 | Expression.Block ( 689 | variables, 690 | [ 691 | yield! nonRecursiveAssignments; 692 | yield! assignToLocalObject; 693 | yield! assignToFuncObject; 694 | yield! assignState; 695 | yield bodyP; 696 | ]) |> asExpr 697 | 698 | | Patterns.Quote(x) -> 699 | let quoteType = inp.Type 700 | if typeof = quoteType then 701 | //QuoteRaw 702 | Expression.Constant(x,quoteType) |> asExpr 703 | else 704 | //QuoteTyped 705 | Expression.Constant(typeof.GetMethod("Cast").MakeGenericMethod(x.Type).Invoke(null, [|x|]),quoteType) |> asExpr 706 | 707 | | Patterns.AddressOf _ -> raise <| new NotSupportedException("Address-of expressions may not be converted to LINQ expressions") 708 | | Patterns.AddressSet _ -> raise <| new NotSupportedException("Address-set expressions may not be converted to LINQ expressions") 709 | 710 | | _ -> 711 | raise <| new NotSupportedException(sprintf "Could not convert the following F# Quotation to a LINQ Expression Tree\n--------\n%A\n-------------\n" inp) 712 | 713 | and ConvObjArg env objOpt coerceTo : Expression = 714 | match objOpt with 715 | | Some(obj) -> 716 | let expr = ConvExpr env obj 717 | match coerceTo with 718 | | None -> expr 719 | | Some ty -> Expression.TypeAs(expr, ty) :> Expression 720 | | None -> 721 | null 722 | 723 | and ConvExprs env es : Expression[] = 724 | es |> List.map (ConvExpr env) |> Array.ofList 725 | 726 | and ConvVar (v: Var) = 727 | //printf "** Expression .Parameter(%a, %a)\n" output_any ty output_any nm; 728 | Expression.Parameter(v.Type, v.Name) 729 | 730 | let (|TraverseExpr|_|) f = function 731 | | ExprShape.ShapeCombination (o, exprlist) -> Some (ExprShape.RebuildShapeCombination (o, List.map f exprlist)) 732 | | ExprShape.ShapeLambda (var, expr) -> Some (Expr.Lambda (var, f expr)) 733 | | untouched -> Some untouched 734 | 735 | let rec constantReplacement var value = function 736 | | Patterns.Var v when v = var -> value 737 | | TraverseExpr (constantReplacement var value) result -> result 738 | | _ -> failwith "Invalid logic" 739 | 740 | let rec optimize = function 741 | | Patterns.Let (var, binding, body) when not var.IsMutable -> 742 | match optimize binding with 743 | | (Patterns.Value _) as value -> optimize <| constantReplacement var value body 744 | | optimizedBinding -> Expr.Let (var, optimizedBinding, optimize body) 745 | | Λ ``-> ..`` (None, [|``type``|], args) when OpRange.TypeProvided ``type`` -> optimize <| Expr.Call (OpRange.GetMethod ``type``, args) 746 | | Λ ``-> .. ..`` (None, [|ty1;ty2|], args) when ty1 = ty2 && OpRangeStep.TypeProvided ty1 -> optimize <| Expr.Call (OpRangeStep.GetMethod ty1, args) 747 | | Λ ``-> |>`` (None, _, [x1;x2]) -> optimize <| Expr.Application (x2, x1) 748 | | Λ ``-> <|`` (None, _, [x1;x2]) -> optimize <| Expr.Application (x1, x2) 749 | | Patterns.Application (Lambda(var, body), input) -> optimize <| Expr.Let (var, input, body) 750 | | Λ ``-> +`` (None, [|t1;_;_|], [x1;x2]) when t1 = typeof -> 751 | let rec getStrings strings = function 752 | | Λ ``-> +`` (None, [|t1;_;_|], [x1;x2]) when t1 = typeof -> getStrings (x2::strings) (x1) 753 | | remainder -> remainder :: strings 754 | let concat = 755 | match getStrings [x2] (x1) with 756 | | s1::s2::[] -> <@@ String.Concat(%%s1, %%s2) @@> 757 | | s1::s2::s3::[] -> <@@ String.Concat(%%s1, %%s2, %%s3) @@> 758 | | s1::s2::s3::s4::[] -> <@@ String.Concat(%%s1, %%s2, %%s3, %%s4) @@> 759 | | strings -> Expr.Call (getMethodInfo <@ String.Concat ([||]:array) @>, [Expr.NewArray (typeof, strings)]) 760 | optimize <| concat 761 | | Λ ``-> id`` (None, _, [x1]) -> optimize x1 762 | | TraverseExpr optimize result -> result 763 | | _ -> failwith "Invalid logic" 764 | 765 | let Conv (e:#Expr, eraseEquality) = 766 | let e = optimize e 767 | let linqExpr = ConvExpr { eraseEquality = eraseEquality; varEnv = Map.empty } e 768 | Expression.Lambda(linqExpr, Expression.Parameter(typeof)) |> asExpression 769 | 770 | let CompileImpl (e: #Expr, eraseEquality) = 771 | let linqExpr = Conv (e,eraseEquality) 772 | let linqExpr = (linqExpr :?> LambdaExpression) 773 | let d = linqExpr.Compile() 774 | (fun () -> 775 | try 776 | d.DynamicInvoke [| box () |] 777 | with :? System.Reflection.TargetInvocationException as exn -> 778 | System.Runtime.ExceptionServices.ExceptionDispatchInfo.Capture(exn.InnerException).Throw() 779 | failwith "Unreachable") 780 | 781 | let Compile (e: #Expr) = CompileImpl(e,false) 782 | 783 | let Eval e = Compile e () 784 | 785 | module QuotationEvaluationExtensions = 786 | open QuotationEvaluationTypes 787 | 788 | type FSharp.Quotations.Expr with 789 | member x.ToLinqExpressionUntyped() = Conv(x, false) 790 | member x.CompileUntyped() = 791 | let f = Compile(x) 792 | f() 793 | member x.EvaluateUntyped() = Eval(x) 794 | 795 | type FSharp.Quotations.Expr<'T> with 796 | member x.Compile() = 797 | let f = Compile(x) 798 | f() :?> 'T 799 | member x.Evaluate() = (Eval(x) :?> 'T) 800 | 801 | open QuotationEvaluationTypes 802 | open QuotationEvaluationExtensions 803 | 804 | [] 805 | type QuotationEvaluator = 806 | static member ToLinqExpression (e: FSharp.Quotations.Expr) = e.ToLinqExpressionUntyped() 807 | static member CompileUntyped (e : FSharp.Quotations.Expr) = e.CompileUntyped() 808 | static member EvaluateUntyped (e : FSharp.Quotations.Expr) = e.EvaluateUntyped() 809 | static member internal EvaluateUntypedUsingQueryApproximations (e: FSharp.Quotations.Expr) = CompileImpl(e, true) () 810 | static member Compile (e : FSharp.Quotations.Expr<'T>) = e.Compile() 811 | static member Evaluate (e : FSharp.Quotations.Expr<'T>) = e.Evaluate() 812 | --------------------------------------------------------------------------------