Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Updated to the latest source drop.

  • Loading branch information...
commit 669bb13d503cbd3ac02319a5279a57a358cdb55a 1 parent b06a582
@panesofglass panesofglass authored
Showing with 29,745 additions and 0 deletions.
  1. 0  {lib → lkg}/FSharp.PowerPack-1.9.7.7/bin/FSharp.Core.dll
  2. 0  {lib → lkg}/FSharp.PowerPack-1.9.7.7/bin/FSharp.PowerPack.Build.Tasks.dll
  3. 0  {lib → lkg}/FSharp.PowerPack-1.9.7.7/bin/FSharp.PowerPack.Build.Tasks.pdb
  4. 0  {lib → lkg}/FSharp.PowerPack-1.9.7.7/bin/FSharp.PowerPack.Build.Tasks.xml
  5. 0  {lib → lkg}/FSharp.PowerPack-1.9.7.7/bin/FSharp.PowerPack.targets
  6. 0  {lib → lkg}/FSharp.PowerPack-1.9.7.7/bin/FsLex.exe
  7. 0  {lib → lkg}/FSharp.PowerPack-1.9.7.7/bin/FsLex.pdb
  8. 0  {lib → lkg}/FSharp.PowerPack-1.9.7.7/bin/FsLex.xml
  9. 0  {lib → lkg}/FSharp.PowerPack-1.9.7.7/bin/FsYacc.exe
  10. 0  {lib → lkg}/FSharp.PowerPack-1.9.7.7/bin/FsYacc.pdb
  11. 0  {lib → lkg}/FSharp.PowerPack-1.9.7.7/bin/FsYacc.xml
  12. +8 −0 workyard/linq/FSharp.PowerPack.Linq/Assembly.fs
  13. +57 −0 workyard/linq/FSharp.PowerPack.Linq/FSharp.PowerPack.Linq.fsproj
  14. +10 −0 workyard/linq/FSharp.PowerPack.Linq/FSharp.PowerPack.Linq.fsproj.vspscc
  15. +959 −0 workyard/linq/FSharp.PowerPack.Linq/FSharp.PowerPack.Linq.xml
  16. +28 −0 workyard/linq/FSharp.PowerPack.Linq/FuncConvertExtensions.fs
  17. +40 −0 workyard/linq/FSharp.PowerPack.Linq/FuncConvertExtensions.fsi
  18. +936 −0 workyard/linq/FSharp.PowerPack.Linq/Linq.fs
  19. +171 −0 workyard/linq/FSharp.PowerPack.Linq/Linq.fsi
  20. +831 −0 workyard/linq/FSharp.PowerPack.Linq/LinqQueries.fs
  21. +61 −0 workyard/linq/FSharp.PowerPack.Linq/LinqQueries.fsi
  22. +181 −0 workyard/linq/FSharp.PowerPack.Linq/MutableTuple.fs
  23. +434 −0 workyard/linq/FSharp.PowerPack.Linq/QueryExtensions.fs
  24. +7 −0 workyard/linq/FSharp.PowerPack.Linq/assemblyinfo.FSharp.PowerPack.Linq.dll.fs
  25. +88 −0 workyard/linq/FSharp.PowerPack.Unittests.v40/FSharp.PowerPack.Unittests.v40.fsproj
  26. +10 −0 workyard/linq/FSharp.PowerPack.Unittests.v40/FSharp.PowerPack.Unittests.v40.fsproj.vspscc
  27. +67 −0 workyard/linq/FSharp.PowerPack.Unittests.v40/LibraryTestFx.fs
  28. +790 −0 workyard/linq/FSharp.PowerPack.Unittests.v40/SeqModule.fs
  29. +1,210 −0 workyard/linq/FSharp.PowerPack.Unittests.v40/SeqModule2.fs
  30. +129 −0 workyard/linq/FSharp.PowerPack.Unittests.v40/Utilities.fs
  31. +229 −0 workyard/linq/FSharp.PowerPack.Unittests/AsyncStreamReaderTest.fs
  32. +611 −0 workyard/linq/FSharp.PowerPack.Unittests/BigRationalTests.fs
  33. +185 −0 workyard/linq/FSharp.PowerPack.Unittests/ColllectionTests.fs
  34. +792 −0 workyard/linq/FSharp.PowerPack.Unittests/CompatTests.fs
  35. +527 −0 workyard/linq/FSharp.PowerPack.Unittests/ControlTests.fs
  36. +119 −0 workyard/linq/FSharp.PowerPack.Unittests/FSharp.PowerPack.Unittests.fsproj
  37. +10 −0 workyard/linq/FSharp.PowerPack.Unittests/FSharp.PowerPack.Unittests.fsproj.vspscc
  38. +93 −0 workyard/linq/FSharp.PowerPack.Unittests/HashtblTests.fs
  39. +137 −0 workyard/linq/FSharp.PowerPack.Unittests/LazyListTests.fs
  40. +47 −0 workyard/linq/FSharp.PowerPack.Unittests/LibraryTestFx.fs
  41. +67 −0 workyard/linq/FSharp.PowerPack.Unittests/Linq/Entities.Northwind/Entities.Northwind.csproj
  42. +6,713 −0 workyard/linq/FSharp.PowerPack.Unittests/Linq/Entities.Northwind/Northwind.Designer.cs
  43. +1,738 −0 workyard/linq/FSharp.PowerPack.Unittests/Linq/Entities.Northwind/Northwind.edmx
  44. +36 −0 workyard/linq/FSharp.PowerPack.Unittests/Linq/Entities.Northwind/Properties/AssemblyInfo.cs
  45. +83 −0 workyard/linq/FSharp.PowerPack.Unittests/Linq/LinqToSql.Northwind/LinqToSql.Northwind.csproj
  46. +412 −0 workyard/linq/FSharp.PowerPack.Unittests/Linq/LinqToSql.Northwind/Northwind.dbml
  47. +271 −0 workyard/linq/FSharp.PowerPack.Unittests/Linq/LinqToSql.Northwind/Northwind.dbml.layout
  48. +6,397 −0 workyard/linq/FSharp.PowerPack.Unittests/Linq/LinqToSql.Northwind/Northwind.designer.cs
  49. +36 −0 workyard/linq/FSharp.PowerPack.Unittests/Linq/LinqToSql.Northwind/Properties/AssemblyInfo.cs
  50. +38 −0 workyard/linq/FSharp.PowerPack.Unittests/Linq/LinqToSql.Northwind/Properties/Settings.Designer.cs
  51. +14 −0 workyard/linq/FSharp.PowerPack.Unittests/Linq/LinqToSql.Northwind/Properties/Settings.settings
  52. +10 −0 workyard/linq/FSharp.PowerPack.Unittests/Linq/LinqToSql.Northwind/app.config
  53. +1,686 −0 workyard/linq/FSharp.PowerPack.Unittests/MatrixVectorTests.fs
  54. +425 −0 workyard/linq/FSharp.PowerPack.Unittests/MetadataTests.fs
  55. BIN  workyard/linq/FSharp.PowerPack.Unittests/NORTHWND.MDF
  56. BIN  workyard/linq/FSharp.PowerPack.Unittests/NORTHWND_log.ldf
  57. +79 −0 workyard/linq/FSharp.PowerPack.Unittests/NUnitFrameworkShims.fs
  58. +554 −0 workyard/linq/FSharp.PowerPack.Unittests/NativeArrayTests.fs
  59. +44 −0 workyard/linq/FSharp.PowerPack.Unittests/PermutationTests.fs
  60. +451 −0 workyard/linq/FSharp.PowerPack.Unittests/QueryTests.fs
  61. +1,473 −0 workyard/linq/FSharp.PowerPack.Unittests/QuotationEvalTests.fs
  62. +245 −0 workyard/linq/FSharp.PowerPack.Unittests/SetMapTests.fs
  63. +11 −0 workyard/linq/FSharp.PowerPack.Unittests/StructuredFormatTests.fs
  64. +129 −0 workyard/linq/FSharp.PowerPack.Unittests/Utilities.fs
  65. +26 −0 workyard/linq/FSharpPowerPackSource.Settings.targets
  66. +36 −0 workyard/linq/FSharpPowerPackSource.targets
  67. +4 −0 workyard/linq/assemblyinfo.Common.fs
View
0  ...arp.PowerPack-1.9.7.7/bin/FSharp.Core.dll → ...arp.PowerPack-1.9.7.7/bin/FSharp.Core.dll
File renamed without changes
View
0  ....7.7/bin/FSharp.PowerPack.Build.Tasks.dll → ....7.7/bin/FSharp.PowerPack.Build.Tasks.dll
File renamed without changes
View
0  ....7.7/bin/FSharp.PowerPack.Build.Tasks.pdb → ....7.7/bin/FSharp.PowerPack.Build.Tasks.pdb
File renamed without changes
View
0  ....7.7/bin/FSharp.PowerPack.Build.Tasks.xml → ....7.7/bin/FSharp.PowerPack.Build.Tasks.xml
File renamed without changes
View
0  ...Pack-1.9.7.7/bin/FSharp.PowerPack.targets → ...Pack-1.9.7.7/bin/FSharp.PowerPack.targets
File renamed without changes
View
0  lib/FSharp.PowerPack-1.9.7.7/bin/FsLex.exe → lkg/FSharp.PowerPack-1.9.7.7/bin/FsLex.exe
File renamed without changes
View
0  lib/FSharp.PowerPack-1.9.7.7/bin/FsLex.pdb → lkg/FSharp.PowerPack-1.9.7.7/bin/FsLex.pdb
File renamed without changes
View
0  lib/FSharp.PowerPack-1.9.7.7/bin/FsLex.xml → lkg/FSharp.PowerPack-1.9.7.7/bin/FsLex.xml
File renamed without changes
View
0  lib/FSharp.PowerPack-1.9.7.7/bin/FsYacc.exe → lkg/FSharp.PowerPack-1.9.7.7/bin/FsYacc.exe
File renamed without changes
View
0  lib/FSharp.PowerPack-1.9.7.7/bin/FsYacc.pdb → lkg/FSharp.PowerPack-1.9.7.7/bin/FsYacc.pdb
File renamed without changes
View
0  lib/FSharp.PowerPack-1.9.7.7/bin/FsYacc.xml → lkg/FSharp.PowerPack-1.9.7.7/bin/FsYacc.xml
File renamed without changes
View
8 workyard/linq/FSharp.PowerPack.Linq/Assembly.fs
@@ -0,0 +1,8 @@
+// (c) Microsoft Corporation 2005-2009.
+
+namespace Microsoft.FSharp
+
+//[<assembly: System.Security.SecurityTransparent>]
+[<assembly: AutoOpen("Microsoft.FSharp")>]
+[<assembly: AutoOpen("Microsoft.FSharp")>]
+do()
View
57 workyard/linq/FSharp.PowerPack.Linq/FSharp.PowerPack.Linq.fsproj
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <FSharpPowerPackSourcesRoot>..</FSharpPowerPackSourcesRoot>
+ <SccProjectName>SAK</SccProjectName>
+ <SccProvider>SAK</SccProvider>
+ <SccAuxPath>SAK</SccAuxPath>
+ <SccLocalPath>SAK</SccLocalPath>
+ </PropertyGroup>
+ <Import Project="$(FSharpPowerPackSourcesRoot)\FSharpPowerPackSource.Settings.targets" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{4c2ed03b-5ace-427b-8285-ad333e60f35e}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AssemblyName>FSharp.PowerPack.Linq</AssemblyName>
+ <AllowCrossTargeting>true</AllowCrossTargeting>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <DocumentationFile>FSharp.PowerPack.Linq.xml</DocumentationFile>
+ <NoWarn>$(NoWarn);9</NoWarn>
+ </PropertyGroup>
+ <!-- These dummy entries are needed for F# Beta2 -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DefineConstants>TRACE;DEBUG;WITHOUT</DefineConstants>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <!-- References -->
+ <ItemGroup>
+ <Reference Include="mscorlib" />
+ <Reference Include="System" />
+ <Reference Include="System.Core" />
+ </ItemGroup>
+ <!-- Files -->
+ <ItemGroup>
+ <Compile Include="..\assemblyinfo.Common.fs">
+ <Link>assemblyinfo.Common.fs</Link>
+ </Compile>
+ <Compile Include="assemblyinfo.FSharp.PowerPack.Linq.dll.fs">
+ <Link>assemblyinfo.FSharp.PowerPack.Linq.dll.fs</Link>
+ </Compile>
+ <Compile Include="FuncConvertExtensions.fsi" />
+ <Compile Include="FuncConvertExtensions.fs" />
+ <Compile Include="MutableTuple.fs" />
+ <Compile Include="Linq.fsi" />
+ <Compile Include="Linq.fs" />
+ <Compile Include="QueryExtensions.fs" />
+ <Compile Include="LinqQueries.fsi" />
+ <Compile Include="LinqQueries.fs" />
+ <Compile Include="Assembly.fs" />
+ </ItemGroup>
+ <Import Project="$(FSharpPowerPackSourcesRoot)\FSharpPowerPackSource.targets" />
+ <Import Project="$(MSBuildExtensionsPath32)\FSharp\1.0\Microsoft.FSharp.Targets" Condition="!Exists('$(MSBuildBinPath)\Microsoft.Build.Tasks.v4.0.dll')" />
+ <Import Project="$(MSBuildExtensionsPath32)\..\Microsoft F#\v4.0\Microsoft.FSharp.Targets" Condition="Exists('$(MSBuildBinPath)\Microsoft.Build.Tasks.v4.0.dll')" />
+ <Import Condition="'$(TargetFramework)'=='Silverlight'" Project="$(MSBuildExtensionsPath32)\Microsoft\Silverlight\$(SilverlightVersion)\Microsoft.Silverlight.Common.targets" />
+</Project>
View
10 workyard/linq/FSharp.PowerPack.Linq/FSharp.PowerPack.Linq.fsproj.vspscc
@@ -0,0 +1,10 @@
+""
+{
+"FILE_VERSION" = "9237"
+"ENLISTMENT_CHOICE" = "NEVER"
+"PROJECT_FILE_RELATIVE_PATH" = ""
+"NUMBER_OF_EXCLUDED_FILES" = "0"
+"ORIGINAL_PROJECT_FILE_PATH" = ""
+"NUMBER_OF_NESTED_PROJECTS" = "0"
+"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
+}
View
959 workyard/linq/FSharp.PowerPack.Linq/FSharp.PowerPack.Linq.xml
@@ -0,0 +1,959 @@
+<?xml version="1.0" encoding="utf-8"?>
+<doc>
+<assembly><name>FSharp.PowerPack.Linq</name></assembly>
+<members>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="M:Microsoft.FSharp.Linq.QuotationEvaluator.ToLinqExpression(Microsoft.FSharp.Quotations.FSharpExpr)">
+<summary>
+ Convert the quotation expression to LINQ expression trees
+
+ This operation will only succeed for a subset of quotation expressions.
+
+ Exceptions: InvalidArgumentException will be raised if the input expression is
+ not in the subset that can be converted to a LINQ expression tree
+</summary>
+</member>
+<member name="">
+
+</member>
+<member name="M:Microsoft.FSharp.Linq.QuotationEvaluator.EvaluateUntyped(Microsoft.FSharp.Quotations.FSharpExpr)">
+<summary>
+ Compile the quotation expression by first converting to LINQ expression trees
+
+ Exceptions: InvalidArgumentException will be raised if the input expression is
+ not in the subset that can be converted to a LINQ expression tree
+</summary>
+</member>
+<member name="M:Microsoft.FSharp.Linq.QuotationEvaluator.Evaluate``1(Microsoft.FSharp.Quotations.FSharpExpr{``0})">
+<summary>
+ Evaluate the quotation expression by first converting to LINQ expression trees
+
+ Exceptions: InvalidArgumentException will be raised if the input expression is
+ not in the subset that can be converted to a LINQ expression tree
+</summary>
+</member>
+<member name="M:Microsoft.FSharp.Linq.QuotationEvaluator.CompileUntyped(Microsoft.FSharp.Quotations.FSharpExpr)">
+<summary>
+ Compile the quotation expression by first converting to LINQ expression trees
+
+ Exceptions: InvalidArgumentException will be raised if the input expression is
+ not in the subset that can be converted to a LINQ expression tree
+</summary>
+</member>
+<member name="M:Microsoft.FSharp.Linq.QuotationEvaluator.Compile``1(Microsoft.FSharp.Quotations.FSharpExpr{``0})">
+<summary>
+ Compile the quotation expression by first converting to LINQ expression trees
+
+ Exceptions: InvalidArgumentException will be raised if the input expression is
+ not in the subset that can be converted to a LINQ expression tree
+</summary>
+</member>
+<member name="">
+
+</member>
+<member name="M:Microsoft.FSharp.Linq.ExtraHashCompare.GenericNotEqualIntrinsic``1(``0,``0)">
+<summary>
+ An intrinsic for compiling &lt;c&gt;&amp;lt;@ x &lt;&gt; y @&amp;gt;&lt;/c&gt; to expression trees
+</summary>
+</member>
+<member name="T:Microsoft.FSharp.Linq.ExtraHashCompare">
+
+</member>
+<member name="M:Microsoft.FSharp.Linq.QueryModule.groupJoin``4(System.Collections.Generic.IEnumerable{``0},System.Collections.Generic.IEnumerable{``1},Microsoft.FSharp.Core.FSharpFunc`2{``0,``2},Microsoft.FSharp.Core.FSharpFunc`2{``1,``2},Microsoft.FSharp.Core.FSharpFunc`2{``0,Microsoft.FSharp.Core.FSharpFunc`2{System.Collections.Generic.IEnumerable{``1},``3}})">
+<summary>
+ This join operator implements the LINQ GroupJoin operator and the &lt;c&gt;query&lt;/c&gt; convertor recognises it as such
+</summary>
+</member>
+<member name="M:Microsoft.FSharp.Linq.QueryModule.join``4(System.Collections.Generic.IEnumerable{``0},System.Collections.Generic.IEnumerable{``1},Microsoft.FSharp.Core.FSharpFunc`2{``0,``2},Microsoft.FSharp.Core.FSharpFunc`2{``1,``2},Microsoft.FSharp.Core.FSharpFunc`2{``0,Microsoft.FSharp.Core.FSharpFunc`2{``1,``3}})">
+<summary>
+ This join operator corresponds to the LINQ Join operator and the &lt;c&gt;query&lt;/c&gt; convertor recognises it as such
+</summary>
+</member>
+<member name="M:Microsoft.FSharp.Linq.QueryModule.groupBy``2(Microsoft.FSharp.Core.FSharpFunc`2{``0,``1},System.Collections.Generic.IEnumerable{``0})">
+<summary>
+ When used in queries, this operator corresponds to the LINQ Join operator and the &lt;c&gt;query&lt;/c&gt; convertor recognises it as such
+</summary>
+</member>
+<member name="M:Microsoft.FSharp.Linq.QueryModule.maxBy``2(Microsoft.FSharp.Core.FSharpFunc`2{``0,``1},System.Collections.Generic.IEnumerable{``0})">
+<summary>
+ When used in queries, this operator corresponds to the LINQ Max operator and the &lt;c&gt;query&lt;/c&gt; convertor recognises it as such
+ It differs in return type from &lt;c&gt;Seq.maxBy&lt;/c&gt;
+</summary>
+</member>
+<member name="M:Microsoft.FSharp.Linq.QueryModule.minBy``2(Microsoft.FSharp.Core.FSharpFunc`2{``0,``1},System.Collections.Generic.IEnumerable{``0})">
+<summary>
+ When used in queries, this operator corresponds to the LINQ Min operator and the &lt;c&gt;query&lt;/c&gt; convertor recognises it as such
+ It differs in return type from &lt;c&gt;Seq.minBy&lt;/c&gt;
+</summary>
+</member>
+<member name="M:Microsoft.FSharp.Linq.QueryModule.contains``1(``0,System.Collections.Generic.IEnumerable{``0})">
+<summary>
+ When used in queries, this operator corresponds to the LINQ Contains operator and the &lt;c&gt;query&lt;/c&gt; convertor recognises it as such
+</summary>
+</member>
+<member name="M:Microsoft.FSharp.Linq.QueryModule.query``1(Microsoft.FSharp.Quotations.FSharpExpr{``0})">
+<summary>
+ Evaluate the quotation expression by first converting to a LINQ expression tree
+ making use of IQueryable operators and then executing expression tree
+
+ Exceptions: &lt;c&gt;InvalidArgumentException&lt;/c&gt; will be raised if the input expression is
+ not in the subset that can be converted to a LINQ expression tree
+</summary>
+</member>
+<member name="T:Microsoft.FSharp.Linq.QueryModule">
+
+</member>
+<member name="">
+
+</member>
+<member name="T:Microsoft.FSharp.Linq.QuotationEvaluation.MemberInitializationHelperType">
+<summary>
+ This type should not be called directly.
+</summary>
+</member>
+<member name="M:Microsoft.FSharp.Linq.QuotationEvaluation.MemberInitializationHelper``1(Microsoft.FSharp.Linq.QuotationEvaluation.MemberInitializationHelperType)">
+<summary>
+ This function should not be called directly.
+</summary>
+</member>
+<member name="M:Microsoft.FSharp.Linq.QuotationEvaluation.LinqExpressionHelper``1(``0)">
+<summary>
+ This function should not be called directly.
+</summary>
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="T:Microsoft.FSharp.Linq.QuotationEvaluation.HelperTypes">
+<summary>
+ A set of types used for implementing quotation conversions.
+ These are public only because targets of Linq Lambda expressions require them to be so
+</summary>
+</member>
+<member name="T:Microsoft.FSharp.Linq.QuotationEvaluation">
+<summary>
+ This module provides Compile and Eval extension members
+ for F# quotation values, implemented by translating to LINQ
+ expression trees and using the LINQ dynamic compiler.
+</summary>
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="T:Microsoft.FSharp.Linq.Runtime.ComparableType">
+<summary>
+ Wrapper for System.Type that implements the &apos;comparable&apos;
+ constraint (to make it possible to use types as keys of Map)
+</summary>
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="T:Microsoft.FSharp.Linq.Runtime.IQuotationAdapter">
+<summary>
+ Represents a rule that modifies quotations in some way
+ Processing quotations and types recursively can be done using
+ IQuotationTransformation passed as argument
+</summary>
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="T:Microsoft.FSharp.Linq.Runtime.IQuotationTransformation">
+<summary>
+ Represents a transformation of quotations that changes both
+ expressions and types (e.g. to replace &apos;int&apos; with &apos;string&apos;)
+ (Recursively processes the whole quotation or type)
+</summary>
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="T:Microsoft.FSharp.Linq.Runtime.MutableTuple`1">
+<summary>
+ This type shouldn&apos;t be used directly from user code.
+</summary>
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="T:Microsoft.FSharp.Linq.Runtime.MutableTuple`2">
+<summary>
+ This type shouldn&apos;t be used directly from user code.
+</summary>
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="T:Microsoft.FSharp.Linq.Runtime.MutableTuple`3">
+<summary>
+ This type shouldn&apos;t be used directly from user code.
+</summary>
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="T:Microsoft.FSharp.Linq.Runtime.MutableTuple`4">
+<summary>
+ This type shouldn&apos;t be used directly from user code.
+</summary>
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="T:Microsoft.FSharp.Linq.Runtime.MutableTuple`5">
+<summary>
+ This type shouldn&apos;t be used directly from user code.
+</summary>
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="T:Microsoft.FSharp.Linq.Runtime.MutableTuple`6">
+<summary>
+ This type shouldn&apos;t be used directly from user code.
+</summary>
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="T:Microsoft.FSharp.Linq.Runtime.MutableTuple`7">
+<summary>
+ This type shouldn&apos;t be used directly from user code.
+</summary>
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="T:Microsoft.FSharp.Linq.Runtime.MutableTuple`8">
+<summary>
+ This type shouldn&apos;t be used directly from user code.
+</summary>
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="M:Microsoft.FSharp.Linq.Runtime.ParameterizedType.Rebuild(Microsoft.FSharp.Collections.FSharpList{System.Type})">
+<summary>
+ Provide arguments to the parameterized type
+</summary>
+</member>
+<member name="T:Microsoft.FSharp.Linq.Runtime.ParameterizedType">
+<summary>
+ Represents information about System.Type that has one or more
+ type parameters (and can be reconstructed when arguments are
+ provided). The type can be pointer, byref, generic or array.
+</summary>
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="M:Microsoft.FSharp.Linq.Runtime.Adapters.TupleAdapter.Microsoft-FSharp-Linq-Runtime-IQuotationAdapter-AdaptType(Microsoft.FSharp.Linq.Runtime.IQuotationTransformation,System.Type)">
+<summary>
+ Turns all top-level uses of tuple into mutable tuples
+</summary>
+</member>
+<member name="M:Microsoft.FSharp.Linq.Runtime.Adapters.TupleAdapter.Microsoft-FSharp-Linq-Runtime-IQuotationAdapter-AdaptExpr(Microsoft.FSharp.Linq.Runtime.IQuotationTransformation,Microsoft.FSharp.Quotations.FSharpExpr)">
+<summary>
+ Turns all tupl-level uses of &apos;NewTuple&apos; and &apos;TupleGet&apos; into
+ corresponding calls (constructor / property get) on mutable tuples
+</summary>
+</member>
+<member name="">
+
+</member>
+<member name="T:Microsoft.FSharp.Linq.Runtime.Adapters.TupleAdapter">
+<summary>
+ Adapts tuples in quotations.
+ (Replace uses of the tuple type with &apos;MutableTuple&apos; type which
+ has get/set properties &amp; parameterless constructor and can be used
+ in LINQ to Entities)
+</summary>
+</member>
+<member name="M:Microsoft.FSharp.Linq.Runtime.Adapters.RecordAdapter.Microsoft-FSharp-Linq-Runtime-IQuotationAdapter-AdaptType(Microsoft.FSharp.Linq.Runtime.IQuotationTransformation,System.Type)">
+<summary>
+ Turns all top-level uses of records into tuples
+</summary>
+</member>
+<member name="M:Microsoft.FSharp.Linq.Runtime.Adapters.RecordAdapter.Microsoft-FSharp-Linq-Runtime-IQuotationAdapter-AdaptExpr(Microsoft.FSharp.Linq.Runtime.IQuotationTransformation,Microsoft.FSharp.Quotations.FSharpExpr)">
+<summary>
+ Turns all tupl-level uses of &apos;NewTuple&apos; and &apos;TupleGet&apos; into
+ corresponding calls (constructor / property get) on mutable tuples
+</summary>
+</member>
+<member name="">
+
+</member>
+<member name="T:Microsoft.FSharp.Linq.Runtime.Adapters.RecordAdapter">
+<summary>
+ Adapts records in quotations (Replaces uses of records with tuples
+ which can be later removed using TupleAdapter)
+</summary>
+</member>
+<member name="M:Microsoft.FSharp.Linq.Runtime.Adapters.|Let|``2(``0,``1)">
+<summary>
+ Declare symbol inside pattern. For example:
+ | Let 1 (i, &lt;NestedPattern#1&gt;)
+ | Let 2 (i, &lt;NestedPattern#2&gt;) -&gt;
+ // i will be either 1 or 2
+</summary>
+</member>
+<member name="T:Microsoft.FSharp.Linq.Runtime.Adapters">
+
+</member>
+<member name="">
+
+</member>
+<member name="">
+
+</member>
+<member name="T:Microsoft.FSharp.Linq.Runtime.Execution">
+
+</member>
+<member name="M:Microsoft.FSharp.Linq.Runtime.Transformations.transformQuotation(Microsoft.FSharp.Linq.Runtime.IQuotationAdapter,Microsoft.FSharp.Collections.FSharpMap{Microsoft.FSharp.Quotations.FSharpVar,Microsoft.FSharp.Quotations.FSharpVar},Microsoft.FSharp.Quotations.FSharpExpr)">
+<summary>
+ Transform quotation using the specified quotation transformation.
+ This replaces expressions according to the &apos;TransformExpr&apos; and
+ replaces types according to the &apos;TransformType&apos; method.
+</summary>
+</member>
+<member name="M:Microsoft.FSharp.Linq.Runtime.Transformations.transformType(Microsoft.FSharp.Linq.Runtime.IQuotationAdapter,Microsoft.FSharp.Linq.Runtime.IQuotationTransformation,System.Type)">
+<summary>
+ Transform a specified type using quotation adapter
+ (This recursively processes all type parameters of the type as well.)
+</summary>
+</member>
+<member name="T:Microsoft.FSharp.Linq.Runtime.Transformations">
+
+</member>
+<member name="T:Microsoft.FSharp.Linq.Runtime.TypeExtensions">
+
+</member>
+<member name="M:Microsoft.FSharp.Linq.Runtime.TypePatterns.|Parameterized|Parameter|Primitive|(System.Type)">
+<summary>
+ Decompose type into several options - A type can be
+ primitive type, type parameter or parameterized type
+</summary>
+</member>
+<member name="T:Microsoft.FSharp.Linq.Runtime.TypePatterns">
+
+</member>
+</members>
+</doc>
View
28 workyard/linq/FSharp.PowerPack.Linq/FuncConvertExtensions.fs
@@ -0,0 +1,28 @@
+// (c) Microsoft Corporation 2005-2009.
+
+
+namespace Microsoft.FSharp.Core
+ open System
+ open System.Linq
+
+ [<Sealed; AbstractClass>]
+ type FuncConvertExtensions =
+
+ static member ToFSharpFunc( f : Action<_,_>) = (fun a1 a2 -> f.Invoke(a1,a2))
+ static member ToFSharpFunc( f : Func<_>) = (fun () -> f.Invoke())
+ static member ToFSharpFunc( f : Func<_,_>) = (fun a1 -> f.Invoke(a1))
+ static member ToFSharpFunc( f : Func<_,_,_>) = (fun a1 a2 -> f.Invoke(a1,a2))
+ static member ToFSharpFunc( f : Action<_,_,_>) = (fun a1 a2 a3 -> f.Invoke(a1,a2,a3))
+ static member ToFSharpFunc( f : Func<_,_,_,_>) = (fun a1 a2 a3 -> f.Invoke(a1,a2,a3))
+ static member ToFSharpFunc( f : Action<_,_,_,_>) = (fun a1 a2 a3 a4 -> f.Invoke(a1,a2,a3,a4))
+ static member ToFSharpFunc( f : Func<_,_,_,_,_>) = (fun a1 a2 a3 a4 -> f.Invoke(a1,a2,a3,a4))
+ static member ToTupledFSharpFunc( f : Func<_>) = (fun () -> f.Invoke())
+ static member ToTupledFSharpFunc( f : Func<_,_>) = (fun a1 -> f.Invoke(a1))
+ static member ToTupledFSharpFunc( f : Action<_,_>) = (fun (a1,a2) -> f.Invoke(a1,a2))
+ static member ToTupledFSharpFunc( f : Func<_,_,_>) = (fun (a1,a2) -> f.Invoke(a1,a2))
+ static member ToTupledFSharpFunc( f : Action<_,_,_>) = (fun (a1,a2,a3) -> f.Invoke(a1,a2,a3))
+ static member ToTupledFSharpFunc( f : Func<_,_,_,_>) = (fun (a1,a2,a3) -> f.Invoke(a1,a2,a3))
+ static member ToTupledFSharpFunc( f : Action<_,_,_,_>) = (fun (a1,a2,a3,a4) -> f.Invoke(a1,a2,a3,a4))
+ static member ToTupledFSharpFunc( f : Func<_,_,_,_,_>) = (fun (a1,a2,a3,a4) -> f.Invoke(a1,a2,a3,a4))
+
+
View
40 workyard/linq/FSharp.PowerPack.Linq/FuncConvertExtensions.fsi
@@ -0,0 +1,40 @@
+// (c) Microsoft Corporation 2005-2009.
+
+namespace Microsoft.FSharp.Core
+ open System
+
+ [<Sealed; AbstractClass>]
+ type FuncConvertExtensions =
+
+ static member ToFSharpFunc : Func<'U> -> (unit -> 'U)
+
+ static member ToFSharpFunc : Func<'T1,'U> -> ('T1 -> 'U)
+
+ static member ToFSharpFunc : Action<'T1,'T2> -> ('T1 -> 'T2 -> unit)
+
+ static member ToFSharpFunc : Func<'T1,'T2,'U> -> ('T1 -> 'T2 -> 'U)
+
+ static member ToFSharpFunc : Action<'T1,'T2,'T3> -> ('T1 -> 'T2 -> 'T3 -> unit)
+
+ static member ToFSharpFunc : Func<'T1,'T2,'T3,'U> -> ('T1 -> 'T2 -> 'T3 -> 'U)
+
+ static member ToFSharpFunc : Action<'T1,'T2,'T3,'T4> -> ('T1 -> 'T2 -> 'T3 -> 'T4 -> unit)
+
+ static member ToFSharpFunc : Func<'T1,'T2,'T3,'T4,'U> -> ('T1 -> 'T2 -> 'T3 -> 'T4 -> 'U)
+
+ static member ToTupledFSharpFunc : Func<'U> -> (unit -> 'U)
+
+ static member ToTupledFSharpFunc : Func<'T1,'U> -> ('T1 -> 'U)
+
+ static member ToTupledFSharpFunc : Action<'T1,'T2> -> ('T1 * 'T2 -> unit)
+
+ static member ToTupledFSharpFunc : Func<'T1,'T2,'U> -> ('T1 * 'T2 -> 'U)
+
+ static member ToTupledFSharpFunc : Action<'T1,'T2,'T3> -> ('T1 * 'T2 * 'T3 -> unit)
+
+ static member ToTupledFSharpFunc : Func<'T1,'T2,'T3,'U> -> ('T1 * 'T2 * 'T3 -> 'U)
+
+ static member ToTupledFSharpFunc : Action<'T1,'T2,'T3,'T4> -> ('T1 * 'T2 * 'T3 * 'T4 -> unit)
+
+ static member ToTupledFSharpFunc : Func<'T1,'T2,'T3,'T4,'U> -> ('T1 * 'T2 * 'T3 * 'T4 -> 'U)
+
View
936 workyard/linq/FSharp.PowerPack.Linq/Linq.fs
@@ -0,0 +1,936 @@
+// Copyright (c) Microsoft Corporation 2005-2008.
+// This sample code is provided "as is" without warranty of any kind.
+// We disclaim all warranties, either express or implied, including the
+// warranties of merchantability and fitness for a particular purpose.
+//
+
+
+namespace Microsoft.FSharp.Linq
+
+open System
+open System.Linq
+open System.Collections.Generic
+open System.Linq.Expressions
+open System.Reflection
+open System.Reflection.Emit
+open Microsoft.FSharp
+open Microsoft.FSharp.Reflection
+open Microsoft.FSharp.Quotations
+open Microsoft.FSharp.Quotations.Patterns
+open Microsoft.FSharp.Quotations.DerivedPatterns
+
+module ExtraHashCompare =
+ let GenericNotEqualIntrinsic<'T> (x:'T) (y:'T) : bool = not (Microsoft.FSharp.Core.LanguagePrimitives.HashCompare.GenericEqualityIntrinsic<'T> x y)
+
+
+module QuotationEvaluation =
+
+ type This =
+ static member Assembly = typeof<This>.Assembly
+
+ let hashCompareType = typeof<list<_>>.Assembly.GetType("Microsoft.FSharp.Core.LanguagePrimitives+HashCompare")
+ let extraHashCompareType = This.Assembly.GetType("Microsoft.FSharp.Linq.ExtraHashCompare")
+ let genericEqualityIntrinsic = "GenericEqualityIntrinsic" |> hashCompareType.GetMethod
+ let genericNotEqualIntrinsic = "GenericNotEqualIntrinsic" |> extraHashCompareType.GetMethod
+ let genericLessThanIntrinsic = "GenericLessThanIntrinsic" |> hashCompareType.GetMethod
+ let genericGreaterThanIntrinsic = "GenericGreaterThanIntrinsic" |> hashCompareType.GetMethod
+ let genericGreaterOrEqualIntrinsic = "GenericGreaterOrEqualIntrinsic" |> hashCompareType.GetMethod
+ let genericLessOrEqualIntrinsic = "GenericLessOrEqualIntrinsic" |> hashCompareType.GetMethod
+
+
+ type ConvEnv =
+ { eraseEquality : bool;
+ varEnv : Map<Var,Expression>
+ }
+ let asExpr x = (x :> Expression)
+
+ let bindingFlags = BindingFlags.Public ||| BindingFlags.NonPublic
+ let instanceBindingFlags = BindingFlags.Instance ||| BindingFlags.Public ||| BindingFlags.NonPublic ||| BindingFlags.DeclaredOnly
+ let isNamedType(typ:Type) = not (typ.IsArray || typ.IsByRef || typ.IsPointer)
+ let equivHeadTypes (ty1:Type) (ty2:Type) =
+ isNamedType(ty1) &&
+ if ty1.IsGenericType then
+ ty2.IsGenericType && (ty1.GetGenericTypeDefinition()).Equals(ty2.GetGenericTypeDefinition())
+ else
+ ty1.Equals(ty2)
+
+ let isFunctionType typ = equivHeadTypes typ (typeof<(int -> int)>)
+ let getFunctionType typ =
+ if not (isFunctionType typ) then invalidArg "typ" "cannot convert recursion except for function types"
+ let tyargs = typ.GetGenericArguments()
+ tyargs.[0], tyargs.[1]
+
+ let WhileHelper gd b : 'T =
+ let rec loop () = if gd() then (b(); loop())
+ loop();
+ unbox (box ())
+
+ let ArrayAssignHelper (arr : 'T[]) (idx:int) (elem:'T) : 'unt =
+ arr.[idx] <- elem;
+ unbox (box ())
+
+
+ let TryFinallyHelper e h =
+ try e()
+ finally h()
+
+ let TryWithHelper e filter handler =
+ try e()
+ with e when (filter e <> 0) -> handler e
+
+ let WhileMethod = match <@@ WhileHelper @@> with Lambdas(_,Call(_,minfo,_)) -> minfo | _ -> failwith "couldn't find minfo"
+ let ArrayAssignMethod = match <@@ ArrayAssignHelper @@> with Lambdas(_,Call(_,minfo,_)) -> minfo | _ -> failwith "couldn't find minfo"
+ let TryFinallyMethod = match <@@ TryFinallyHelper @@> with Lambdas(_,Call(_,minfo,_)) -> minfo | _ -> failwith "couldn't find minfo"
+ let TryWithMethod = match <@@ TryWithHelper @@> with Lambdas(_,Call(_,minfo,_)) -> minfo | _ -> failwith "couldn't find minfo"
+ let StringConcat = match <@@ String.Concat : obj * obj -> string @@> with Lambdas(_, Call(_, minfo, _)) -> minfo | _ -> failwith "couldn't find minfo"
+
+ module HelperTypes =
+ type ActionHelper<'T1,'T2,'T3,'T4,'T5> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 -> unit
+ type ActionHelper<'T1,'T2,'T3,'T4,'T5,'T6> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 -> unit
+ type ActionHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 -> unit
+ type ActionHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 -> unit
+ type ActionHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 -> unit
+ type ActionHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 -> unit
+ type ActionHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 -> unit
+ type ActionHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 -> unit
+ type ActionHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12, 'T13> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 * 'T13 -> unit
+ type ActionHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12, 'T13, 'T14> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 * 'T13 * 'T14 -> unit
+ type ActionHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12, 'T13, 'T14, 'T15> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 * 'T13 * 'T14 * 'T15 -> unit
+ type ActionHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12, 'T13, 'T14, 'T15, 'T16> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 * 'T13 * 'T14 * 'T15 * 'T16 -> unit
+ type ActionHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12, 'T13, 'T14, 'T15, 'T16, 'T17> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 * 'T13 * 'T14 * 'T15 * 'T16 * 'T17 -> unit
+ type ActionHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12, 'T13, 'T14, 'T15, 'T16, 'T17, 'T18> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 * 'T13 * 'T14 * 'T15 * 'T16 * 'T17 * 'T18 -> unit
+ type ActionHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12, 'T13, 'T14, 'T15, 'T16, 'T17, 'T18, 'T19> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 * 'T13 * 'T14 * 'T15 * 'T16 * 'T17 * 'T18 * 'T19 -> unit
+ type ActionHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12, 'T13, 'T14, 'T15, 'T16, 'T17, 'T18, 'T19, 'T20> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 * 'T13 * 'T14 * 'T15 * 'T16 * 'T17 * 'T18 * 'T19 * 'T20 -> unit
+
+ type FuncHelper<'T1,'T2,'T3,'T4,'T5,'T6> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 -> 'T6
+ type FuncHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 -> 'T7
+ type FuncHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 -> 'T8
+ type FuncHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 -> 'T9
+ type FuncHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 -> 'T10
+ type FuncHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 -> 'T11
+ type FuncHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 -> 'T12
+ type FuncHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12, 'T13> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 -> 'T13
+ type FuncHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12, 'T13, 'T14> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 * 'T13 -> 'T14
+ type FuncHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12, 'T13, 'T14, 'T15> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 * 'T13 * 'T14 -> 'T15
+ type FuncHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12, 'T13, 'T14, 'T15, 'T16> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 * 'T13 * 'T14 * 'T15 -> 'T16
+ type FuncHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12, 'T13, 'T14, 'T15, 'T16, 'T17> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 * 'T13 * 'T14 * 'T15 * 'T16 -> 'T17
+ type FuncHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12, 'T13, 'T14, 'T15, 'T16, 'T17, 'T18> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 * 'T13 * 'T14 * 'T15 * 'T16 * 'T17 -> 'T18
+ type FuncHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12, 'T13, 'T14, 'T15, 'T16, 'T17, 'T18, 'T19> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 * 'T13 * 'T14 * 'T15 * 'T16 * 'T17 * 'T18 -> 'T19
+ type FuncHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12, 'T13, 'T14, 'T15, 'T16, 'T17, 'T18, 'T19, 'T20> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 * 'T13 * 'T14 * 'T15 * 'T16 * 'T17 * 'T18 * 'T19 -> 'T20
+ type FuncHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12, 'T13, 'T14, 'T15, 'T16, 'T17, 'T18, 'T19, 'T20, 'T21> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 * 'T13 * 'T14 * 'T15 * 'T16 * 'T17 * 'T18 * 'T19 * 'T20 -> 'T21
+
+ open HelperTypes
+
+ let GetActionType (args:Type[]) =
+ if args.Length <= 4 then
+ Expression.GetActionType args
+ else
+ match args.Length with
+ | 5 -> typedefof<ActionHelper<_,_,_,_,_>>.MakeGenericType args
+ | 6 -> typedefof<ActionHelper<_,_,_,_,_,_>>.MakeGenericType args
+ | 7 -> typedefof<ActionHelper<_,_,_,_,_,_,_>>.MakeGenericType args
+ | 8 -> typedefof<ActionHelper<_,_,_,_,_,_,_,_>>.MakeGenericType args
+ | 9 -> typedefof<ActionHelper<_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+ | 10 -> typedefof<ActionHelper<_,_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+ | 11 -> typedefof<ActionHelper<_,_,_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+ | 12 -> typedefof<ActionHelper<_,_,_,_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+ | 13 -> typedefof<ActionHelper<_,_,_,_,_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+ | 14 -> typedefof<ActionHelper<_,_,_,_,_,_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+ | 15 -> typedefof<ActionHelper<_,_,_,_,_,_,_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+ | 16 -> typedefof<ActionHelper<_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+ | 17 -> typedefof<ActionHelper<_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+ | 18 -> typedefof<ActionHelper<_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+ | 19 -> typedefof<ActionHelper<_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+ | 20 -> typedefof<ActionHelper<_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+ | _ -> raise <| new 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")
+
+ let GetFuncType (args:Type[]) =
+ if args.Length <= 5 then
+ Expression.GetFuncType args
+ else
+ match args.Length with
+ | 6 -> typedefof<FuncHelper<_,_,_,_,_,_>>.MakeGenericType args
+ | 7 -> typedefof<FuncHelper<_,_,_,_,_,_,_>>.MakeGenericType args
+ | 8 -> typedefof<FuncHelper<_,_,_,_,_,_,_,_>>.MakeGenericType args
+ | 9 -> typedefof<FuncHelper<_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+ | 10 -> typedefof<FuncHelper<_,_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+ | 11 -> typedefof<FuncHelper<_,_,_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+ | 12 -> typedefof<FuncHelper<_,_,_,_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+ | 13 -> typedefof<FuncHelper<_,_,_,_,_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+ | 14 -> typedefof<FuncHelper<_,_,_,_,_,_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+ | 15 -> typedefof<FuncHelper<_,_,_,_,_,_,_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+ | 16 -> typedefof<FuncHelper<_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+ | 17 -> typedefof<FuncHelper<_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+ | 18 -> typedefof<FuncHelper<_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+ | 19 -> typedefof<FuncHelper<_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+ | 20 -> typedefof<FuncHelper<_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+ | 21 -> typedefof<FuncHelper<_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+ | _ -> raise <| new 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")
+
+
+ let LetRec1Helper (F1:System.Func<_,_,_>) (B:System.Func<_,_>) =
+ let fhole = ref (Unchecked.defaultof<_>)
+ let f = new System.Func<_,_>(fun x -> F1.Invoke(fhole.Value,x))
+ fhole := f
+ B.Invoke f
+
+ let LetRec2Helper (F1:System.Func<_,_,_,_>) (F2:System.Func<_,_,_,_>) (B:System.Func<_,_,_>) =
+ let f1hole = ref (Unchecked.defaultof<_>)
+ let f2hole = ref (Unchecked.defaultof<_>)
+ let f1 = new System.Func<_,_>(fun x -> F1.Invoke(f1hole.Value,f2hole.Value,x))
+ let f2 = new System.Func<_,_>(fun x -> F2.Invoke(f1hole.Value,f2hole.Value,x))
+ f1hole := f1
+ f2hole := f2
+ B.Invoke(f1,f2)
+
+ let LetRec3Helper (F1:System.Func<_,_,_,_,_>) (F2:System.Func<_,_,_,_,_>) (F3:System.Func<_,_,_,_,_>) (B:System.Func<_,_,_,_>) =
+ let f1hole = ref (Unchecked.defaultof<_>)
+ let f2hole = ref (Unchecked.defaultof<_>)
+ let f3hole = ref (Unchecked.defaultof<_>)
+ let f1 = new System.Func<_,_>(fun x -> F1.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,x))
+ let f2 = new System.Func<_,_>(fun x -> F2.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,x))
+ let f3 = new System.Func<_,_>(fun x -> F3.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,x))
+ f1hole := f1
+ f2hole := f2
+ f3hole := f3
+ B.Invoke(f1,f2,f3)
+
+ let LetRec4Helper
+ (F1:FuncHelper<_,_,_,_,_,_>)
+ (F2:FuncHelper<_,_,_,_,_,_>)
+ (F3:FuncHelper<_,_,_,_,_,_>)
+ (F4:FuncHelper<_,_,_,_,_,_>)
+ (B:System.Func<_,_,_,_,_>) =
+ let f1hole = ref (Unchecked.defaultof<_>)
+ let f2hole = ref (Unchecked.defaultof<_>)
+ let f3hole = ref (Unchecked.defaultof<_>)
+ let f4hole = ref (Unchecked.defaultof<_>)
+ let f1 = new System.Func<_,_>(fun x -> F1.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,x))
+ let f2 = new System.Func<_,_>(fun x -> F2.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,x))
+ let f3 = new System.Func<_,_>(fun x -> F3.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,x))
+ let f4 = new System.Func<_,_>(fun x -> F4.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,x))
+ f1hole := f1
+ f2hole := f2
+ f3hole := f3
+ f4hole := f4
+ B.Invoke(f1,f2,f3,f4)
+
+
+ let LetRec5Helper
+ (F1:FuncHelper<_,_,_,_,_,_,_>)
+ (F2:FuncHelper<_,_,_,_,_,_,_>)
+ (F3:FuncHelper<_,_,_,_,_,_,_>)
+ (F4:FuncHelper<_,_,_,_,_,_,_>)
+ (F5:FuncHelper<_,_,_,_,_,_,_>)
+ (B:FuncHelper<_,_,_,_,_,_>) =
+ let f1hole = ref (Unchecked.defaultof<_>)
+ let f2hole = ref (Unchecked.defaultof<_>)
+ let f3hole = ref (Unchecked.defaultof<_>)
+ let f4hole = ref (Unchecked.defaultof<_>)
+ let f5hole = ref (Unchecked.defaultof<_>)
+ let f1 = new System.Func<_,_>(fun x -> F1.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,x))
+ let f2 = new System.Func<_,_>(fun x -> F2.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,x))
+ let f3 = new System.Func<_,_>(fun x -> F3.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,x))
+ let f4 = new System.Func<_,_>(fun x -> F4.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,x))
+ let f5 = new System.Func<_,_>(fun x -> F5.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,x))
+ f1hole := f1
+ f2hole := f2
+ f3hole := f3
+ f4hole := f4
+ f5hole := f5
+ B.Invoke(f1,f2,f3,f4,f5)
+
+ let LetRec6Helper
+ (F1:FuncHelper<_,_,_,_,_,_,_,_>)
+ (F2:FuncHelper<_,_,_,_,_,_,_,_>)
+ (F3:FuncHelper<_,_,_,_,_,_,_,_>)
+ (F4:FuncHelper<_,_,_,_,_,_,_,_>)
+ (F5:FuncHelper<_,_,_,_,_,_,_,_>)
+ (F6:FuncHelper<_,_,_,_,_,_,_,_>)
+ (B:FuncHelper<_,_,_,_,_,_,_>) =
+ let f1hole = ref (Unchecked.defaultof<_>)
+ let f2hole = ref (Unchecked.defaultof<_>)
+ let f3hole = ref (Unchecked.defaultof<_>)
+ let f4hole = ref (Unchecked.defaultof<_>)
+ let f5hole = ref (Unchecked.defaultof<_>)
+ let f6hole = ref (Unchecked.defaultof<_>)
+ let f1 = new System.Func<_,_>(fun x -> F1.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,f6hole.Value,x))
+ let f2 = new System.Func<_,_>(fun x -> F2.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,f6hole.Value,x))
+ let f3 = new System.Func<_,_>(fun x -> F3.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,f6hole.Value,x))
+ let f4 = new System.Func<_,_>(fun x -> F4.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,f6hole.Value,x))
+ let f5 = new System.Func<_,_>(fun x -> F5.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,f6hole.Value,x))
+ let f6 = new System.Func<_,_>(fun x -> F6.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,f6hole.Value,x))
+ f1hole := f1
+ f2hole := f2
+ f3hole := f3
+ f4hole := f4
+ f5hole := f5
+ f6hole := f6
+ B.Invoke(f1,f2,f3,f4,f5,f6)
+
+
+ let LetRec7Helper
+ (F1:FuncHelper<_,_,_,_,_,_,_,_,_>)
+ (F2:FuncHelper<_,_,_,_,_,_,_,_,_>)
+ (F3:FuncHelper<_,_,_,_,_,_,_,_,_>)
+ (F4:FuncHelper<_,_,_,_,_,_,_,_,_>)
+ (F5:FuncHelper<_,_,_,_,_,_,_,_,_>)
+ (F6:FuncHelper<_,_,_,_,_,_,_,_,_>)
+ (F7:FuncHelper<_,_,_,_,_,_,_,_,_>)
+ (B:FuncHelper<_,_,_,_,_,_,_,_>) =
+ let f1hole = ref (Unchecked.defaultof<_>)
+ let f2hole = ref (Unchecked.defaultof<_>)
+ let f3hole = ref (Unchecked.defaultof<_>)
+ let f4hole = ref (Unchecked.defaultof<_>)
+ let f5hole = ref (Unchecked.defaultof<_>)
+ let f6hole = ref (Unchecked.defaultof<_>)
+ let f7hole = ref (Unchecked.defaultof<_>)
+ let f1 = new System.Func<_,_>(fun x -> F1.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,f6hole.Value,f7hole.Value,x))
+ let f2 = new System.Func<_,_>(fun x -> F2.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,f6hole.Value,f7hole.Value,x))
+ let f3 = new System.Func<_,_>(fun x -> F3.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,f6hole.Value,f7hole.Value,x))
+ let f4 = new System.Func<_,_>(fun x -> F4.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,f6hole.Value,f7hole.Value,x))
+ let f5 = new System.Func<_,_>(fun x -> F5.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,f6hole.Value,f7hole.Value,x))
+ let f6 = new System.Func<_,_>(fun x -> F6.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,f6hole.Value,f7hole.Value,x))
+ let f7 = new System.Func<_,_>(fun x -> F7.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,f6hole.Value,f7hole.Value,x))
+ f1hole := f1
+ f2hole := f2
+ f3hole := f3
+ f4hole := f4
+ f5hole := f5
+ f6hole := f6
+ f7hole := f7
+ B.Invoke(f1,f2,f3,f4,f5,f6,f7)
+
+
+ let LetRec8Helper
+ (F1:FuncHelper<_,_,_,_,_,_,_,_,_,_>)
+ (F2:FuncHelper<_,_,_,_,_,_,_,_,_,_>)
+ (F3:FuncHelper<_,_,_,_,_,_,_,_,_,_>)
+ (F4:FuncHelper<_,_,_,_,_,_,_,_,_,_>)
+ (F5:FuncHelper<_,_,_,_,_,_,_,_,_,_>)
+ (F6:FuncHelper<_,_,_,_,_,_,_,_,_,_>)
+ (F7:FuncHelper<_,_,_,_,_,_,_,_,_,_>)
+ (F8:FuncHelper<_,_,_,_,_,_,_,_,_,_>)
+ (B:FuncHelper<_,_,_,_,_,_,_,_,_>) =
+ let f1hole = ref (Unchecked.defaultof<_>)
+ let f2hole = ref (Unchecked.defaultof<_>)
+ let f3hole = ref (Unchecked.defaultof<_>)
+ let f4hole = ref (Unchecked.defaultof<_>)
+ let f5hole = ref (Unchecked.defaultof<_>)
+ let f6hole = ref (Unchecked.defaultof<_>)
+ let f7hole = ref (Unchecked.defaultof<_>)
+ let f8hole = ref (Unchecked.defaultof<_>)
+ let f1 = new System.Func<_,_>(fun x -> F1.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,f6hole.Value,f7hole.Value,f8hole.Value,x))
+ let f2 = new System.Func<_,_>(fun x -> F2.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,f6hole.Value,f7hole.Value,f8hole.Value,x))
+ let f3 = new System.Func<_,_>(fun x -> F3.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,f6hole.Value,f7hole.Value,f8hole.Value,x))
+ let f4 = new System.Func<_,_>(fun x -> F4.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,f6hole.Value,f7hole.Value,f8hole.Value,x))
+ let f5 = new System.Func<_,_>(fun x -> F5.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,f6hole.Value,f7hole.Value,f8hole.Value,x))
+ let f6 = new System.Func<_,_>(fun x -> F6.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,f6hole.Value,f7hole.Value,f8hole.Value,x))
+ let f7 = new System.Func<_,_>(fun x -> F7.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,f6hole.Value,f7hole.Value,f8hole.Value,x))
+ let f8 = new System.Func<_,_>(fun x -> F8.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,f6hole.Value,f7hole.Value,f8hole.Value,x))
+ f1hole := f1
+ f2hole := f2
+ f3hole := f3
+ f4hole := f4
+ f5hole := f5
+ f6hole := f6
+ f7hole := f7
+ f8hole := f8
+ B.Invoke(f1,f2,f3,f4,f5,f6,f7,f8)
+
+
+ let IsVoidType (ty:System.Type) = (ty = typeof<System.Void>)
+
+ // The following two are used to store recognized 'member intialization pattern' in the quotation
+ // (it is recognized in LinqQueries and then translated to 'Expression.MemberInit' in Linq)
+ type internal MemberInitializationHelperType =
+ | MemberInitialization of Expr * Expr list
+
+ let internal MemberInitializationHelper (a:MemberInitializationHelperType) : 'R =
+ failwith "This function should not be called directly. "
+
+
+ let SequentialHelper (x:'T) (y:'U) = y
+
+ let LinqExpressionHelper (x:'T) : Expression<'T> = failwith ""
+
+ let MakeFakeExpression (x:Expr) =
+ let minfo = match <@@ LinqExpressionHelper @@> with Lambda(_,Call(_,minfo,_)) -> minfo | _ -> failwith "couldn't find method info"
+ Expr.Call(minfo.GetGenericMethodDefinition().MakeGenericMethod [| x.Type |], [ x ])
+
+ let showAll = BindingFlags.Public ||| BindingFlags.NonPublic
+
+ let WrapVoid b objOpt args (env: ConvEnv) (e:Expression) =
+ if b then
+ let frees (e:Expr) = e.GetFreeVars()
+ let addFrees e acc = List.foldBack Set.add (frees e |> Seq.toList) acc
+ let fvs = Option.foldBack addFrees objOpt (List.foldBack addFrees args Set.empty) |> Set.toArray
+ let fvsP = fvs |> Array.map (fun v -> (Map.find v env.varEnv :?> ParameterExpression))
+ let fvtys = fvs |> Array.map (fun v -> v.Type)
+
+ let dty = GetActionType fvtys
+ let e = Expression.Lambda(dty,e,fvsP)
+ let d = e.Compile()
+
+ let argtys = Array.append fvtys [| dty |]
+ let delP = Expression.Parameter(dty, "del")
+
+ let m = new System.Reflection.Emit.DynamicMethod("wrapper",typeof<unit>,argtys)
+ let ilg = m.GetILGenerator()
+
+ ilg.Emit(OpCodes.Ldarg ,fvs.Length)
+ fvs |> Array.iteri (fun i _ -> ilg.Emit(OpCodes.Ldarg ,int16 i))
+ ilg.EmitCall(OpCodes.Callvirt,dty.GetMethod("Invoke",instanceBindingFlags),null)
+ ilg.Emit(OpCodes.Ldnull)
+ ilg.Emit(OpCodes.Ret)
+ let args = Array.append (fvsP |> Array.map asExpr) [| (Expression.Constant(d) |> asExpr) |]
+ Expression.Call((null:Expression),(m:>MethodInfo),args) |> asExpr
+ else
+ e
+
+ let (|GenericEqualityQ|_|) = (|SpecificCall|_|) <@ LanguagePrimitives.GenericEquality @>
+ let (|EqualsQ|_|) = (|SpecificCall|_|) <@ ( = ) @>
+ let (|GreaterQ|_|) = (|SpecificCall|_|) <@ ( > ) @>
+ let (|GreaterEqQ|_|) = (|SpecificCall|_|) <@ ( >=) @>
+ let (|LessQ|_|) = (|SpecificCall|_|) <@ ( <) @>
+ let (|LessEqQ|_|) = (|SpecificCall|_|) <@ ( <=) @>
+ let (|NotEqQ|_|) = (|SpecificCall|_|) <@ ( <>) @>
+ let (|NotQ|_|) = (|SpecificCall|_|) <@ not @>
+ let (|NegQ|_|) = (|SpecificCall|_|) <@ ( ~-) : int -> int @>
+ let (|PlusQ|_|) = (|SpecificCall|_|) <@ ( + ) @>
+ let (|DivideQ|_|) = (|SpecificCall|_|) <@ ( / ) @>
+ let (|MinusQ|_|) = (|SpecificCall|_|) <@ ( - ) @>
+ let (|MultiplyQ|_|) = (|SpecificCall|_|) <@ ( * ) @>
+ let (|ModuloQ|_|) = (|SpecificCall|_|) <@ ( % ) @>
+ let (|ShiftLeftQ|_|) = (|SpecificCall|_|) <@ ( <<< ) @>
+ let (|ShiftRightQ|_|) = (|SpecificCall|_|) <@ ( >>> ) @>
+ let (|BitwiseAndQ|_|) = (|SpecificCall|_|) <@ ( &&& ) @>
+ let (|BitwiseOrQ|_|) = (|SpecificCall|_|) <@ ( ||| ) @>
+ let (|BitwiseXorQ|_|) = (|SpecificCall|_|) <@ ( ^^^ ) @>
+ let (|BitwiseNotQ|_|) = (|SpecificCall|_|) <@ ( ~~~ ) @>
+ let (|CheckedNeg|_|) = (|SpecificCall|_|) <@ Checked.( ~-) : int -> int @>
+ let (|CheckedPlusQ|_|) = (|SpecificCall|_|) <@ Checked.( + ) @>
+ let (|CheckedMinusQ|_|) = (|SpecificCall|_|) <@ Checked.( - ) @>
+ let (|CheckedMultiplyQ|_|) = (|SpecificCall|_|) <@ Checked.( * ) @>
+ let (|ConvCharQ|_|) = (|SpecificCall|_|) <@ char @>
+ let (|ConvDecimalQ|_|) = (|SpecificCall|_|) <@ decimal @>
+ let (|ConvFloatQ|_|) = (|SpecificCall|_|) <@ float @>
+ let (|ConvFloat32Q|_|) = (|SpecificCall|_|) <@ float32 @>
+ let (|ConvSByteQ|_|) = (|SpecificCall|_|) <@ sbyte @>
+ let (|ConvInt16Q|_|) = (|SpecificCall|_|) <@ int16 @>
+ let (|ConvInt32Q|_|) = (|SpecificCall|_|) <@ int32 @>
+ let (|ConvIntQ|_|) = (|SpecificCall|_|) <@ int @>
+ let (|ConvInt64Q|_|) = (|SpecificCall|_|) <@ int64 @>
+ let (|ConvByteQ|_|) = (|SpecificCall|_|) <@ byte @>
+ let (|ConvUInt16Q|_|) = (|SpecificCall|_|) <@ uint16 @>
+ let (|ConvUInt32Q|_|) = (|SpecificCall|_|) <@ uint32 @>
+ let (|ConvUInt64Q|_|) = (|SpecificCall|_|) <@ uint64 @>
+
+ let (|CheckedConvCharQ|_|) = (|SpecificCall|_|) <@ Checked.char @>
+ let (|CheckedConvSByteQ|_|) = (|SpecificCall|_|) <@ Checked.sbyte @>
+ let (|CheckedConvInt16Q|_|) = (|SpecificCall|_|) <@ Checked.int16 @>
+ let (|CheckedConvInt32Q|_|) = (|SpecificCall|_|) <@ Checked.int32 @>
+ let (|CheckedConvInt64Q|_|) = (|SpecificCall|_|) <@ Checked.int64 @>
+ let (|CheckedConvByteQ|_|) = (|SpecificCall|_|) <@ Checked.byte @>
+ let (|CheckedConvUInt16Q|_|) = (|SpecificCall|_|) <@ Checked.uint16 @>
+ let (|CheckedConvUInt32Q|_|) = (|SpecificCall|_|) <@ Checked.uint32 @>
+ let (|CheckedConvUInt64Q|_|) = (|SpecificCall|_|) <@ Checked.uint64 @>
+ let (|LinqExpressionHelperQ|_|) = (|SpecificCall|_|) <@ LinqExpressionHelper @>
+ let (|ArrayLookupQ|_|) = (|SpecificCall|_|) <@ LanguagePrimitives.IntrinsicFunctions.GetArray : int[] -> int -> int @>
+ let (|ArrayAssignQ|_|) = (|SpecificCall|_|) <@ LanguagePrimitives.IntrinsicFunctions.SetArray : int[] -> int -> int -> unit @>
+ let (|ArrayTypeQ|_|) (ty:System.Type) = if ty.IsArray && ty.GetArrayRank() = 1 then Some(ty.GetElementType()) else None
+
+ /// Extract member initialization expression stored in 'MemberInitializationHelper' (by LinqQueries.fs)
+ let (|MemberInitializationQ|_|) = function
+ | SpecificCall <@ MemberInitializationHelper @> (None, _, [ Patterns.Value(:? MemberInitializationHelperType as mt, _) ]) ->
+ let (MemberInitialization(init, props)) = mt
+ Some(init, props)
+ | _ -> None
+
+ /// Convert F# quotations to LINQ expression trees.
+ /// A more polished LINQ-Quotation translator will be published
+ /// concert with later versions of LINQ.
+ let rec ConvExpr (env:ConvEnv) (inp:Expr) =
+ //printf "ConvExpr : %A\n" inp
+ match inp with
+
+ // Generic cases
+ | Patterns.Var(v) ->
+ try
+ Map.find v env.varEnv
+ with
+ | :? KeyNotFoundException when v.Name = "this" ->
+ let message =
+ "Encountered unxpected variable named 'this'. This might happen because " +
+ "quotations used in queries can’t contain references to let-bound values in classes unless the quotation literal occurs in an instance member. " +
+ "If this is the case, workaround by replacing references to implicit fields with references to " +
+ "local variables, e.g. rewrite\r\n" +
+ " type Foo() =\r\n" +
+ " let x = 1\r\n" +
+ " let bar() = <@ x @>\r\n" +
+ "as: \r\n" +
+ " type Foo() =\r\n" +
+ " let x = 1\r\n" +
+ " let bar() = let x = x in <@ x @>\r\n";
+
+ NotSupportedException(message) |> raise
+ | DerivedPatterns.AndAlso(x1,x2) -> Expression.AndAlso(ConvExpr env x1, ConvExpr env x2) |> asExpr
+ | DerivedPatterns.OrElse(x1,x2) -> Expression.OrElse(ConvExpr env x1, ConvExpr env x2) |> asExpr
+ | Patterns.Value(x,ty) -> Expression.Constant(x,ty) |> asExpr
+
+ // REVIEW: exact F# semantics for TypeAs and TypeIs
+ | Patterns.Coerce(x,toTy) ->
+ let converted = ConvExpr env x
+
+ // Linq to Entities doesn't like 'TypeAs' expressions (coercion from
+ // IQueryable<T> to IEnumerable<T>) that are generated e.g. in:
+ //
+ // <@ seq { for p in dx.Products do
+ // for c in dx.Categories do yield p } @>
+ //
+ // However, the expression tree has 'C# semantics' so we don't need
+ // explicit TypeAs if the coercion is statically type-safe. The rules are subtle,
+ // so we don't generate TypeAs (at least) in a simple case when both are
+ // reference types and the assignment is statically safe.
+ // (see also ``Join using nested 'for' with 'String.Concat' call`` test in v40 build)
+
+ if not toTy.IsValueType && not x.Type.IsValueType && toTy.IsAssignableFrom(x.Type) then converted
+ else Expression.TypeAs(ConvExpr env x,toTy) |> asExpr
+
+ | Patterns.TypeTest(x,toTy) ->
+ Expression.TypeIs(ConvExpr env x,toTy) |> asExpr
+
+ // Expr.*Get
+ | Patterns.FieldGet(objOpt,fieldInfo) ->
+ Expression.Field(ConvObjArg env objOpt None, fieldInfo) |> asExpr
+
+ | Patterns.TupleGet(arg,n) ->
+ let argP = ConvExpr env arg
+ let rec build ty argP n =
+ match Reflection.FSharpValue.PreComputeTuplePropertyInfo(ty,n) with
+ | propInfo,None ->
+ Expression.Property(argP, propInfo) |> asExpr
+ | propInfo,Some(nestedTy,n2) ->
+ build nestedTy (Expression.Property(argP,propInfo) |> asExpr) n2
+ build arg.Type argP n
+
+ | Patterns.PropertyGet(objOpt,propInfo,args) ->
+ let coerceTo =
+ if objOpt.IsSome && FSharpType.IsUnion propInfo.DeclaringType && FSharpType.IsUnion propInfo.DeclaringType.BaseType then
+ Some propInfo.DeclaringType
+ else
+ None
+ match args with
+ | [] ->
+ Expression.Property(ConvObjArg env objOpt coerceTo, propInfo) |> asExpr
+ | _ ->
+ let argsP = ConvExprs env args
+ Expression.Call(ConvObjArg env objOpt coerceTo, propInfo.GetGetMethod(true),argsP) |> asExpr
+
+ // Expr.*Set
+ | Patterns.PropertySet(objOpt,propInfo,args,v) ->
+ let args = (args @ [v])
+ let argsP = ConvExprs env args
+ let minfo = propInfo.GetSetMethod(true)
+ Expression.Call(ConvObjArg env objOpt None, minfo,argsP) |> asExpr |> WrapVoid (IsVoidType minfo.ReturnType) objOpt args env
+
+ // Object initialization generated by LinqQueries
+ | MemberInitializationQ(ctor, propInfos) ->
+ let bindings =
+ [| for p in propInfos ->
+ match p with
+ | Patterns.PropertySet(_, pinfo, args, assign) ->
+ if args <> [] then raise (NotSupportedException "Parameterized properties not supported in member initialization.")
+ Expression.Bind(pinfo, ConvExpr env assign) :> MemberBinding
+ | _ -> failwith "Expected PropertySet in member initialization." |]
+ match ConvExpr env ctor with
+ | :? NewExpression as converted ->
+ Expression.MemberInit(converted, bindings) |> asExpr
+ | _ -> failwith "Expected Constructor call in member initialization."
+
+ // Expr.(Call,Application)
+ | Patterns.Call(objOpt,minfo,args) ->
+ let transComparison x1 x2 exprConstructor exprErasedConstructor (intrinsic : MethodInfo) =
+ let e1 = ConvExpr env x1
+ let e2 = ConvExpr env x2
+
+ if env.eraseEquality then
+ exprErasedConstructor(e1,e2) |> asExpr
+ else
+ exprConstructor(e1, e2, false, intrinsic.MakeGenericMethod([|x1.Type|])) |> asExpr
+
+ match inp with
+ // Special cases for this translation
+
+ // Do the same thing as C# compiler (It would be nicer to use 'String.Concat(string[])'
+ // but that's not supported in Linq to Entities. See also the test
+ // ``Join using nested 'for' with string concatenation``
+
+ | PlusQ (_, [ty1;ty2;ty3],[x1;x2]) when (ty1 = typeof<string>) && (ty2 = typeof<string>) ->
+ Expression.Add(ConvExpr env x1, ConvExpr env x2, StringConcat) |> asExpr
+
+
+ //| SpecificCall <@ LanguagePrimitives.GenericEquality @>([ty1],[x1;x2])
+ //| SpecificCall <@ ( = ) @>([ty1],[x1;x2]) when (ty1 = typeof<string>) ->
+ // ConvExpr env (<@@ System.String.op_Equality(%%x1,%%x2) @@>)
+
+ | GenericEqualityQ (_, _,[x1;x2])
+ | EqualsQ (_, _,[x1;x2]) -> transComparison x1 x2 Expression.Equal Expression.Equal genericEqualityIntrinsic
+
+ | GreaterQ (_, _,[x1;x2]) -> transComparison x1 x2 Expression.GreaterThan Expression.GreaterThan genericGreaterThanIntrinsic
+
+ | GreaterEqQ (_, _,[x1;x2]) -> transComparison x1 x2 Expression.GreaterThanOrEqual Expression.GreaterThanOrEqual genericGreaterOrEqualIntrinsic
+
+ | LessQ (_, _,[x1;x2]) -> transComparison x1 x2 Expression.LessThan Expression.LessThan genericLessThanIntrinsic
+
+ | LessEqQ (_, _,[x1;x2]) -> transComparison x1 x2 Expression.LessThanOrEqual Expression.LessThanOrEqual genericLessOrEqualIntrinsic
+
+ | NotEqQ (_, _,[x1;x2]) -> transComparison x1 x2 Expression.NotEqual Expression.NotEqual genericNotEqualIntrinsic
+
+ | NotQ (_, _,[x1]) -> Expression.Not(ConvExpr env x1) |> asExpr
+
+
+ | NegQ (_, _,[x1]) -> Expression.Negate(ConvExpr env x1) |> asExpr
+ | PlusQ (_, _,[x1;x2]) -> Expression.Add(ConvExpr env x1, ConvExpr env x2) |> asExpr
+ | DivideQ (_, _,[x1;x2]) -> Expression.Divide (ConvExpr env x1, ConvExpr env x2) |> asExpr
+ | MinusQ (_, _,[x1;x2]) -> Expression.Subtract(ConvExpr env x1, ConvExpr env x2) |> asExpr
+ | MultiplyQ (_, _,[x1;x2]) -> Expression.Multiply(ConvExpr env x1, ConvExpr env x2) |> asExpr
+ | ModuloQ (_, _,[x1;x2]) -> Expression.Modulo (ConvExpr env x1, ConvExpr env x2) |> asExpr
+ /// REVIEW: basic arithmetic with method witnesses
+ /// REVIEW: negate,add, divide, multiply, subtract with method witness
+
+ | ShiftLeftQ (_, _,[x1;x2]) -> Expression.LeftShift(ConvExpr env x1, ConvExpr env x2) |> asExpr
+ | ShiftRightQ (_, _,[x1;x2]) -> Expression.RightShift(ConvExpr env x1, ConvExpr env x2) |> asExpr
+ | BitwiseAndQ (_, _,[x1;x2]) -> Expression.And(ConvExpr env x1, ConvExpr env x2) |> asExpr
+ | BitwiseOrQ (_, _,[x1;x2]) -> Expression.Or(ConvExpr env x1, ConvExpr env x2) |> asExpr
+ | BitwiseXorQ (_, _,[x1;x2]) -> Expression.ExclusiveOr(ConvExpr env x1, ConvExpr env x2) |> asExpr
+ | BitwiseNotQ (_, _,[x1]) -> Expression.Not(ConvExpr env x1) |> asExpr
+ /// REVIEW: bitwise operations with method witnesses
+
+ | CheckedNeg (_, _,[x1]) -> Expression.NegateChecked(ConvExpr env x1) |> asExpr
+ | CheckedPlusQ (_, _,[x1;x2]) -> Expression.AddChecked(ConvExpr env x1, ConvExpr env x2) |> asExpr
+ | CheckedMinusQ (_, _,[x1;x2]) -> Expression.SubtractChecked(ConvExpr env x1, ConvExpr env x2) |> asExpr
+ | CheckedMultiplyQ (_, _,[x1;x2]) -> Expression.MultiplyChecked(ConvExpr env x1, ConvExpr env x2) |> asExpr
+
+ | ConvCharQ (_, [ty],[x1]) -> Expression.Convert(ConvExpr env x1, typeof<char>) |> asExpr
+ | ConvDecimalQ (_, [ty],[x1]) -> Expression.Convert(ConvExpr env x1, typeof<decimal>) |> asExpr
+ | ConvFloatQ (_, [ty],[x1]) -> Expression.Convert(ConvExpr env x1, typeof<float>) |> asExpr
+ | ConvFloat32Q (_, [ty],[x1]) -> Expression.Convert(ConvExpr env x1, typeof<float32>) |> asExpr
+ | ConvSByteQ (_, [ty],[x1]) -> Expression.Convert(ConvExpr env x1, typeof<sbyte>) |> asExpr
+ | ConvInt16Q (_, [ty],[x1]) -> Expression.Convert(ConvExpr env x1, typeof<int16>) |> asExpr
+ | ConvInt32Q (_, [ty],[x1]) -> Expression.Convert(ConvExpr env x1, typeof<int32>) |> asExpr
+ | ConvIntQ (_, [ty],[x1]) -> Expression.Convert(ConvExpr env x1, typeof<int32>) |> asExpr
+ | ConvInt64Q (_, [ty],[x1]) -> Expression.Convert(ConvExpr env x1, typeof<int64>) |> asExpr
+ | ConvByteQ (_, [ty],[x1]) -> Expression.Convert(ConvExpr env x1, typeof<byte>) |> asExpr
+ | ConvUInt16Q (_, [ty],[x1]) -> Expression.Convert(ConvExpr env x1, typeof<uint16>) |> asExpr
+ | ConvUInt32Q (_, [ty],[x1]) -> Expression.Convert(ConvExpr env x1, typeof<uint32>) |> asExpr
+ | ConvUInt64Q (_, [ty],[x1]) -> Expression.Convert(ConvExpr env x1, typeof<uint64>) |> asExpr
+ /// REVIEW: convert with method witness
+
+ | CheckedConvCharQ (_, [ty],[x1]) -> Expression.ConvertChecked(ConvExpr env x1, typeof<char>) |> asExpr
+ | CheckedConvSByteQ (_, [ty],[x1]) -> Expression.ConvertChecked(ConvExpr env x1, typeof<sbyte>) |> asExpr
+ | CheckedConvInt16Q (_, [ty],[x1]) -> Expression.ConvertChecked(ConvExpr env x1, typeof<int16>) |> asExpr
+ | CheckedConvInt32Q (_, [ty],[x1]) -> Expression.ConvertChecked(ConvExpr env x1, typeof<int32>) |> asExpr
+ | CheckedConvInt64Q (_, [ty],[x1]) -> Expression.ConvertChecked(ConvExpr env x1, typeof<int64>) |> asExpr
+ | CheckedConvByteQ (_, [ty],[x1]) -> Expression.ConvertChecked(ConvExpr env x1, typeof<byte>) |> asExpr
+ | CheckedConvUInt16Q (_, [ty],[x1]) -> Expression.ConvertChecked(ConvExpr env x1, typeof<uint16>) |> asExpr
+ | CheckedConvUInt32Q (_, [ty],[x1]) -> Expression.ConvertChecked(ConvExpr env x1, typeof<uint32>) |> asExpr
+ | CheckedConvUInt64Q (_, [ty],[x1]) -> Expression.ConvertChecked(ConvExpr env x1, typeof<uint64>) |> asExpr
+ | ArrayLookupQ (_, [ArrayTypeQ(elemTy);_;_],[x1;x2]) ->
+ Expression.ArrayIndex(ConvExpr env x1, ConvExpr env x2) |> asExpr
+
+ | ArrayAssignQ (_, [ArrayTypeQ(elemTy);_;_],[arr;idx;elem]) ->
+ let minfo = ArrayAssignMethod.GetGenericMethodDefinition().MakeGenericMethod [| elemTy;typeof<unit> |]
+ Expression.Call(minfo,[| ConvExpr env arr; ConvExpr env idx; ConvExpr env elem |]) |> asExpr
+
+ // Throw away markers inserted to satisfy C#'s design where they pass an argument
+ // or type T to an argument expecting Expr<T>.
+ | LinqExpressionHelperQ (_, [_],[x1]) -> ConvExpr env x1
+
+ /// ArrayLength
+ /// ListBind
+ /// ListInit
+ /// ElementInit
+ | _ ->
+ let argsP = ConvExprs env args
+ Expression.Call(ConvObjArg env objOpt None, minfo, argsP) |> asExpr |> WrapVoid (IsVoidType minfo.ReturnType) objOpt args env
+
+ // f x1 x2 x3 x4 --> InvokeFast4
+ | Patterns.Application(Patterns.Application(Patterns.Application(Patterns.Application(f,arg1),arg2),arg3),arg4) ->
+ let domainTy1, rangeTy = getFunctionType f.Type
+ let domainTy2, rangeTy = getFunctionType rangeTy
+ let domainTy3, rangeTy = getFunctionType rangeTy
+ let domainTy4, rangeTy = getFunctionType rangeTy
+ let (-->) ty1 ty2 = Reflection.FSharpType.MakeFunctionType(ty1,ty2)
+ let ty = domainTy1 --> domainTy2
+ let meth = (ty.GetMethods() |> Array.find (fun minfo -> minfo.Name = "InvokeFast" && minfo.GetParameters().Length = 5)).MakeGenericMethod [| domainTy3; domainTy4; rangeTy |]
+ let argsP = ConvExprs env [f; arg1;arg2;arg3; arg4]
+ Expression.Call((null:Expression), meth, argsP) |> asExpr
+
+ // f x1 x2 x3 --> InvokeFast3
+ | Patterns.Application(Patterns.Application(Patterns.Application(f,arg1),arg2),arg3) ->
+ let domainTy1, rangeTy = getFunctionType f.Type
+ let domainTy2, rangeTy = getFunctionType rangeTy
+ let domainTy3, rangeTy = getFunctionType rangeTy
+ let (-->) ty1 ty2 = Reflection.FSharpType.MakeFunctionType(ty1,ty2)
+ let ty = domainTy1 --> domainTy2
+ let meth = (ty.GetMethods() |> Array.find (fun minfo -> minfo.Name = "InvokeFast" && minfo.GetParameters().Length = 4)).MakeGenericMethod [| domainTy3; rangeTy |]
+ let argsP = ConvExprs env [f; arg1;arg2;arg3]
+ Expression.Call((null:Expression), meth, argsP) |> asExpr
+
+ // f x1 x2 --> InvokeFast2
+ | Patterns.Application(Patterns.Application(f,arg1),arg2) ->
+ let domainTy1, rangeTy = getFunctionType f.Type
+ let domainTy2, rangeTy = getFunctionType rangeTy
+ let (-->) ty1 ty2 = Reflection.FSharpType.MakeFunctionType(ty1,ty2)
+ let ty = domainTy1 --> domainTy2
+ let meth = (ty.GetMethods() |> Array.find (fun minfo -> minfo.Name = "InvokeFast" && minfo.GetParameters().Length = 3)).MakeGenericMethod [| rangeTy |]
+ let argsP = ConvExprs env [f; arg1;arg2]
+ Expression.Call((null:Expression), meth, argsP) |> asExpr
+
+ // f x1 --> Invoke
+ | Patterns.Application(f,arg) ->
+ let fP = ConvExpr env f
+ let argP = ConvExpr env arg
+ let meth = f.Type.GetMethod("Invoke")
+ Expression.Call(fP, meth, [| argP |]) |> asExpr
+
+ // Expr.New*
+ | Patterns.NewRecord(recdTy,args) ->
+ let ctorInfo = Reflection.FSharpValue.PreComputeRecordConstructorInfo(recdTy,showAll)
+ Expression.New(ctorInfo,ConvExprs env args) |> asExpr
+
+ | Patterns.NewArray(ty,args) ->
+ Expression.NewArrayInit(ty,ConvExprs env args) |> asExpr
+
+ | Patterns.DefaultValue(ty) ->
+ Expression.New(ty) |> asExpr
+
+ | Patterns.NewUnionCase(unionCaseInfo,args) ->
+ let methInfo = Reflection.FSharpValue.PreComputeUnionConstructorInfo(unionCaseInfo,showAll)
+ let argsR = ConvExprs env args
+ Expression.Call((null:Expression),methInfo,argsR) |> asExpr
+
+ | Patterns.UnionCaseTest(e,unionCaseInfo) ->
+ let methInfo = Reflection.FSharpValue.PreComputeUnionTagMemberInfo(unionCaseInfo.DeclaringType,showAll)
+ let obj = ConvExpr env e
+ let tagE =
+ match methInfo with
+ | :? PropertyInfo as p ->
+ Expression.Property(obj,p) |> asExpr
+ | :? MethodInfo as m ->
+ Expression.Call((null:Expression),m,[| obj |]) |> asExpr
+ | _ -> failwith "unreachable case"
+ Expression.Equal(tagE, Expression.Constant(unionCaseInfo.Tag)) |> asExpr
+
+ | Patterns.NewObject(ctorInfo,args) ->
+ Expression.New(ctorInfo,ConvExprs env args) |> asExpr
+
+ | Patterns.NewDelegate(dty,vs,b) ->
+ let vsP = List.map ConvVar vs
+ let env = {env with varEnv = List.foldBack2 (fun (v:Var) vP -> Map.add v (vP |> asExpr)) vs vsP env.varEnv }
+ let bodyP = ConvExpr env b
+ Expression.Lambda(dty, bodyP, vsP) |> asExpr
+
+ | Patterns.NewTuple(args) ->
+ let tupTy = args |> List.map (fun arg -> arg.Type) |> Array.ofList |> Reflection.FSharpType.MakeTupleType
+ let argsP = ConvExprs env args
+ let rec build ty (argsP: Expression[]) =
+ match Reflection.FSharpValue.PreComputeTupleConstructorInfo(ty) with
+ | ctorInfo,None -> Expression.New(ctorInfo,argsP) |> asExpr
+ | ctorInfo,Some(nestedTy) ->
+ let n = ctorInfo.GetParameters().Length - 1
+ Expression.New(ctorInfo, Array.append argsP.[0..n-1] [| build nestedTy argsP.[n..] |]) |> asExpr
+ build tupTy argsP
+
+ | Patterns.IfThenElse(g,t,e) ->
+ Expression.Condition(ConvExpr env g, ConvExpr env t,ConvExpr env e) |> asExpr
+
+ | Patterns.Sequential (e1,e2) ->
+ let e1P = ConvExpr env e1
+ let e2P = ConvExpr env e2
+ let minfo = match <@@ SequentialHelper @@> with Lambdas(_,Call(_,minfo,_)) -> minfo | _ -> failwith "couldn't find minfo"
+ let minfo = minfo.GetGenericMethodDefinition().MakeGenericMethod [| e1.Type; e2.Type |]
+ Expression.Call(minfo,[| e1P; e2P |]) |> asExpr
+
+ | Patterns.Let (v,e,b) ->
+ let vP = ConvVar v
+ let envinner = { env with varEnv = Map.add v (vP |> asExpr) env.varEnv }
+ let bodyP = ConvExpr envinner b
+ let eP = ConvExpr env e
+ let ty = GetFuncType [| v.Type; b.Type |]
+ let lam = Expression.Lambda(ty,bodyP,[| vP |]) |> asExpr
+ Expression.Call(lam,ty.GetMethod("Invoke",instanceBindingFlags),[| eP |]) |> asExpr
+
+ | Patterns.Lambda(v,body) ->
+ let vP = ConvVar v
+ let env = { env with varEnv = Map.add v (vP |> asExpr) env.varEnv }
+ let tyargs = [| v.Type; body.Type |]
+ let bodyP = ConvExpr env body
+ let convType = typedefof<System.Converter<obj,obj>>.MakeGenericType tyargs
+ let convDelegate = Expression.Lambda(convType, bodyP, [| vP |]) |> asExpr
+ Expression.Call(typeof<FuncConvert>,"ToFSharpFunc",tyargs,[| convDelegate |]) |> asExpr
+
+ | Patterns.WhileLoop(gd,b) ->
+ let gdP = ConvExpr env <@@ (fun () -> (%%gd:bool)) @@>
+ let bP = ConvExpr env <@@ (fun () -> (%%b:unit)) @@>
+ let minfo = WhileMethod.GetGenericMethodDefinition().MakeGenericMethod [| typeof<unit> |]
+ Expression.Call(minfo,[| gdP; bP |]) |> asExpr
+
+ | Patterns.TryFinally(e,h) ->
+ let eP = ConvExpr env (Expr.Lambda(new Var("unitVar",typeof<unit>), e))
+ let hP = ConvExpr env <@@ (fun () -> (%%h:unit)) @@>
+ let minfo = TryFinallyMethod.GetGenericMethodDefinition().MakeGenericMethod [| e.Type |]
+ Expression.Call(minfo,[| eP; hP |]) |> asExpr
+
+ | Patterns.TryWith(e,vf,filter,vh,handler) ->
+ let eP = ConvExpr env (Expr.Lambda(new Var("unitVar",typeof<unit>), e))
+ let filterP = ConvExpr env (Expr.Lambda(vf,filter))
+ let handlerP = ConvExpr env (Expr.Lambda(vh,handler))
+ let minfo = TryWithMethod.GetGenericMethodDefinition().MakeGenericMethod [| e.Type |]
+ Expression.Call(minfo,[| eP; filterP; handlerP |]) |> asExpr
+
+ | Patterns.LetRecursive(binds,body) ->
+
+ let vfs = List.map fst binds
+
+ let pass1 =
+ binds |> List.map (fun (vf,expr) ->
+ match expr with
+ | Lambda(vx,expr) ->
+ let domainTy,rangeTy = getFunctionType vf.Type
+ let vfdTy = GetFuncType [| domainTy; rangeTy |]
+ let vfd = new Var("d",vfdTy)
+ (vf,vx,expr,domainTy,rangeTy,vfdTy,vfd)
+ | _ -> failwith "cannot convert recursive bindings that do not define functions")
+
+ let trans = pass1 |> List.map (fun (vf,vx,expr,domainTy,rangeTy,vfdTy,vfd) -> (vf,vfd)) |> Map.ofList
+
+ // Rewrite uses of the recursively defined functions to be invocations of the delegates
+ // We do this because the delegate are allocated "once" and we can normally just invoke them efficiently
+ let rec rw t =
+ match t with
+ | Application(Var(vf),t) when trans.ContainsKey(vf) ->
+ let vfd = trans.[vf]
+ Expr.Call(Expr.Var(vfd),vfd.Type.GetMethod("Invoke",instanceBindingFlags),[t])
+ | ExprShape.ShapeVar(vf) when trans.ContainsKey(vf)->
+ let vfd = trans.[vf]
+ let nv = new Var("nv",fst(getFunctionType vf.Type))
+ Expr.Lambda(nv,Expr.Call(Expr.Var(vfd),vfd.Type.GetMethod("Invoke",instanceBindingFlags),[Expr.Var(nv)]))
+ | ExprShape.ShapeVar(_) -> t
+ | ExprShape.ShapeCombination(obj,args) -> ExprShape.RebuildShapeCombination(obj,List.map rw args)
+ | ExprShape.ShapeLambda(v,arg) -> Expr.Lambda(v,rw arg)
+
+ let vfdTys = pass1 |> List.map (fun (vf,vx,expr,domainTy,rangeTy,vfdTy,vfd) -> vfdTy) |> Array.ofList
+ let vfds = pass1 |> List.map (fun (vf,vx,expr,domainTy,rangeTy,vfdTy,vfd) -> vfd)
+
+ let FPs =
+ [| for (vf,vx,expr,domainTy,rangeTy,vfdTy,vfd) in pass1 do
+ let expr = rw expr
+ let tyF = GetFuncType (Array.append vfdTys [| vx.Type; expr.Type |])
+ let F = Expr.NewDelegate(tyF,vfds@[vx],expr)
+ let FP = ConvExpr env F
+ yield FP |]
+
+ let body = rw body
+
+ let methTys =
+ [| for (vf,vx,expr,domainTy,rangeTy,vfdTy,vfd) in pass1 do
+ yield domainTy
+ yield rangeTy
+ yield body.Type |]
+
+ let B = Expr.NewDelegate(GetFuncType (Array.append vfdTys [| body.Type |]),vfds,body)
+ let BP = ConvExpr env B
+
+ let minfo =
+ let q =
+ match vfds.Length with
+ | 1 -> <@@ LetRec1Helper @@>
+ | 2 -> <@@ LetRec2Helper @@>
+ | 3 -> <@@ LetRec3Helper @@>
+ | 4 -> <@@ LetRec4Helper @@>
+ | 5 -> <@@ LetRec5Helper @@>
+ | 6 -> <@@ LetRec6Helper @@>
+ | 7