diff --git a/.gitignore b/.gitignore index 07c58243..1b9f4b12 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,9 @@ tools/ packages/ -nuget/ +gh-pages/ +release/ +generated/ *.DotSettings ################# @@ -173,3 +175,6 @@ pip-log.txt # For References !*/References/*.pdb + +# Generated documentation files +Documentation/Output/*.html diff --git a/.nuget/NuGet.exe b/.nuget/NuGet.exe index c296edf1..2c936984 100644 Binary files a/.nuget/NuGet.exe and b/.nuget/NuGet.exe differ diff --git a/.nuget/NuGet.targets b/.nuget/NuGet.targets index 46a1b6ce..83fe9060 100644 --- a/.nuget/NuGet.targets +++ b/.nuget/NuGet.targets @@ -18,9 +18,9 @@ - + @@ -50,9 +50,12 @@ -RequireConsent -NonInteractive + "$(SolutionDir) " + "$(SolutionDir)" + - $(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(NonInteractiveSwitch) $(RequireConsentSwitch) -solutionDir "$(SolutionDir) " - $(NuGetCommand) pack "$(ProjectPath)" -Properties Configuration=$(Configuration) $(NonInteractiveSwitch) -OutputDirectory "$(PackageOutputDir)" -symbols + $(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(NonInteractiveSwitch) $(RequireConsentSwitch) -solutionDir $(PaddedSolutionDir) + $(NuGetCommand) pack "$(ProjectPath)" -Properties "Configuration=$(Configuration);Platform=$(Platform)" $(NonInteractiveSwitch) -OutputDirectory "$(PackageOutputDir)" -symbols @@ -118,7 +121,7 @@ Log.LogMessage("Downloading latest version of NuGet.exe..."); WebClient webClient = new WebClient(); - webClient.DownloadFile("https://nuget.org/nuget.exe", OutputFilename); + webClient.DownloadFile("https://www.nuget.org/nuget.exe", OutputFilename); return true; } diff --git a/AssemblyInfo.fs b/AssemblyInfo.fs deleted file mode 100644 index 6622d99e..00000000 --- a/AssemblyInfo.fs +++ /dev/null @@ -1,10 +0,0 @@ -module AssemblyInfo -open System.Reflection - -[] -[] -[] -[] -[] - -() diff --git a/Build.bat b/Build.bat deleted file mode 100644 index f64f51a0..00000000 --- a/Build.bat +++ /dev/null @@ -1,7 +0,0 @@ -@echo off -cls -if not exist "tools\FAKE\tools\Fake.exe" ( - ".\.nuget\nuget.exe" "install" "FAKE" "-OutputDirectory" "tools" "-ExcludeVersion" -) -"tools\FAKE\tools\Fake.exe" build.fsx -pause \ No newline at end of file diff --git a/Build.fsx b/Build.fsx deleted file mode 100644 index 41c59ee7..00000000 --- a/Build.fsx +++ /dev/null @@ -1,93 +0,0 @@ -// include Fake lib -#r @"tools\FAKE\tools\FakeLib.dll" -open Fake -open Fake.AssemblyInfoFile - -// Assembly / NuGet package properties -let projectName = "RProvider" -let companyName = "Blue Mountain Capital" -let version = "1.0.3" -let projectSummary = "An F# Type Provider providing strongly typed access to the R statistical package." -let projectDescription = "An F# type provider for interoperating with R" -let authors = ["BlueMountain Capital"] - -// Folders -let buildDir = @".\build\" -let nugetDir = @".\nuget\" - -// Restore NuGet packages -!+ "./**/packages.config" - ++ "./packages.config" - |> ScanImmediately - |> Seq.iter (RestorePackage (fun p -> - {p with - ToolPath = "./.nuget/NuGet.exe"})) -// Targets - -// Update assembly info -Target "UpdateAssemblyInfo" (fun _ -> - CreateFSharpAssemblyInfo ".\AssemblyInfo.fs" - [ Attribute.Product projectName - Attribute.Title projectName - Attribute.Description projectDescription - Attribute.Company companyName - Attribute.Version version ] -) - -// Clean build directory -Target "Clean" (fun _ -> - CleanDir buildDir -) - -// Build RProvider -Target "BuildRProvider" (fun _ -> - !! @"rprovider.fsproj" - |> MSBuildRelease buildDir "ReBuild" - |> Log "AppBuild-Output: " -) - -// Clean NuGet directory -Target "CleanNuGet" (fun _ -> - CleanDir nugetDir -) - -// Create NuGet package -Target "CreateNuGet" (fun _ -> - System.IO.Directory.CreateDirectory(nugetDir @@ "tools") |> ignore - System.IO.File.Copy(@".\init.ps1", nugetDir @@ "tools\init.ps1") - - XCopy @".\build\" (nugetDir @@ "lib") - !+ @"nuget/lib/*.*" - -- @"nuget/lib/RProvider*.*" - |> ScanImmediately - |> Seq.iter (System.IO.File.Delete) - - "RProvider.nuspec" - |> NuGet (fun p -> - {p with - Project = projectName - Authors = authors - Version = version - Description = projectDescription - Summary = projectSummary - NoPackageAnalysis = true - ToolPath = @".\.nuget\Nuget.exe" - WorkingDir = nugetDir - OutputPath = nugetDir }) -) - -// Default target -Target "Default" (fun _ -> - trace "Building R Provider" -) - -// Dependencies -"UpdateAssemblyInfo" - ==> "Clean" - ==> "BuildRProvider" - ==> "CleanNuGet" - ==> "CreateNuGet" - ==> "Default" - -// start build -Run "Default" \ No newline at end of file diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md new file mode 100644 index 00000000..33a4c77a --- /dev/null +++ b/RELEASE_NOTES.md @@ -0,0 +1 @@ +* 1.0.3 - Fixed NuGet package \ No newline at end of file diff --git a/Test.RProvider/Test.RProvider.sln b/RProvider.Tests.sln similarity index 89% rename from Test.RProvider/Test.RProvider.sln rename to RProvider.Tests.sln index ae170dae..37326452 100644 --- a/Test.RProvider/Test.RProvider.sln +++ b/RProvider.Tests.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2012 -Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Test.RProvider", "Test.RProvider.fsproj", "{A371037F-5B03-4C6C-91D3-5DFD494E0BFB}" +Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Test.RProvider", "tests\Test.RProvider\Test.RProvider.fsproj", "{A371037F-5B03-4C6C-91D3-5DFD494E0BFB}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/RProvider.sln b/RProvider.sln index 34cc6211..a484e617 100644 --- a/RProvider.sln +++ b/RProvider.sln @@ -1,24 +1,42 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2012 -Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "RProvider", "RProvider.fsproj", "{5624F098-BE3F-4C8E-B50F-1CFC9E1E0708}" +Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "RProvider", "src\RProvider\RProvider.fsproj", "{5624F098-BE3F-4C8E-B50F-1CFC9E1E0708}" EndProject -Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "RWrapperGenerator", "RWrapperGenerator\RWrapperGenerator.fsproj", "{66A390A5-526A-4BD1-B876-E7425B643C70}" +Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "RWrapperGenerator", "src\RWrapperGenerator\RWrapperGenerator.fsproj", "{66A390A5-526A-4BD1-B876-E7425B643C70}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{5FA7D1AD-DEDA-4553-81D1-6E4728386A2F}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{5FA7D1AD-DEDA-4553-81D1-6E4728386A2F}" ProjectSection(SolutionItems) = preProject - Build.bat = Build.bat - Build.fsx = Build.fsx - RProvider.nuspec = RProvider.nuspec + build.cmd = build.cmd + build.fsx = build.fsx EndProjectSection EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{793EB77C-8AD2-4571-AA94-9C69F9D4065F}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{6D45A358-1BAC-4180-BEE7-39996F45DEAC}" ProjectSection(SolutionItems) = preProject .nuget\NuGet.Config = .nuget\NuGet.Config .nuget\NuGet.exe = .nuget\NuGet.exe .nuget\NuGet.targets = .nuget\NuGet.targets EndProjectSection EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Docs", "Docs", "{B34F96AE-40C8-44AC-8D82-5196202C080E}" + ProjectSection(SolutionItems) = preProject + docs\Charts-QuickStart.fsx = docs\Charts-QuickStart.fsx + docs\howto.md = docs\howto.md + docs\index.md = docs\index.md + docs\internals.md = docs\internals.md + docs\passing-data.fsx = docs\passing-data.fsx + docs\plugins.md = docs\plugins.md + docs\Statistics-QuickStart.fsx = docs\Statistics-QuickStart.fsx + docs\tutorial.fsx = docs\tutorial.fsx + docs\whatwhy.md = docs\whatwhy.md + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tools", "Tools", "{9C22FF03-BB06-4332-8104-20AB4959BABA}" + ProjectSection(SolutionItems) = preProject + tools\build.fsx = tools\build.fsx + tools\template.html = tools\template.html + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -37,4 +55,7 @@ Global GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {9C22FF03-BB06-4332-8104-20AB4959BABA} = {B34F96AE-40C8-44AC-8D82-5196202C080E} + EndGlobalSection EndGlobal diff --git a/Test.RProvider/References/FsCheck.Xunit.dll b/Test.RProvider/References/FsCheck.Xunit.dll deleted file mode 100644 index 7b2b521d..00000000 Binary files a/Test.RProvider/References/FsCheck.Xunit.dll and /dev/null differ diff --git a/Test.RProvider/References/FsCheck.Xunit.pdb b/Test.RProvider/References/FsCheck.Xunit.pdb deleted file mode 100644 index 3c4ad83f..00000000 Binary files a/Test.RProvider/References/FsCheck.Xunit.pdb and /dev/null differ diff --git a/Test.RProvider/References/FsCheck.Xunit.xml b/Test.RProvider/References/FsCheck.Xunit.xml deleted file mode 100644 index 53025fe9..00000000 --- a/Test.RProvider/References/FsCheck.Xunit.xml +++ /dev/null @@ -1,99 +0,0 @@ - - -FsCheck.Xunit - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Test.RProvider/References/FsCheck.dll b/Test.RProvider/References/FsCheck.dll deleted file mode 100644 index 7db6d578..00000000 Binary files a/Test.RProvider/References/FsCheck.dll and /dev/null differ diff --git a/Test.RProvider/References/FsCheck.pdb b/Test.RProvider/References/FsCheck.pdb deleted file mode 100644 index cec1043f..00000000 Binary files a/Test.RProvider/References/FsCheck.pdb and /dev/null differ diff --git a/Test.RProvider/References/FsCheck.xml b/Test.RProvider/References/FsCheck.xml deleted file mode 100644 index e2af9134..00000000 --- a/Test.RProvider/References/FsCheck.xml +++ /dev/null @@ -1,2219 +0,0 @@ - - -FsCheck - - - - - - -Returns a generator for 'a. - - - - - - - - - - -Returns a sequence of the immediate shrinks of the given value. The immediate shrinks should not include -doubles or the given value itself. The default implementation returns the empty sequence (i.e. no shrinking). - - - - - - - - - - - Check all public static methods on the given type that have a testable return type with the verbose configuration, -and throws on failure or exhaustion. - - - - - Check all public static methods on the given type that have a testable return type with vthe erbose configuration, -and throws on failure or exhaustion. - - - - -Check one property with the verbose configuration, and throw an exception if it fails or is exhausted. - - - - - Check all public static methods on the given type that have a testable return type with vthe erbose configuration - - - - - Check all public static methods on the given type that have a testable return type with vthe erbose configuration - - - - -Check one property with the verbose configuration, and using the given name. - - - - -Check one property with the verbose configuration. - - - - -Check all public static methods on the given type that have a testable return type with quick configuration - - - - -Check all public static methods on the given type that have a testable return type with quick configuration, -and throw on failure or exhaustion. - - - - -Check one property with the quick configuration, and throw an exception if it fails or is exhausted. - - - - -Check all public static methods on the given type that have a testable return type with quick configuration - - - - -Check all public static methods on the given type that have a testable return type with quick configuration - - - - -Check one property with the quick configuration, and using the given name. - - - - -Check one property with the quick configuration. - - - - -Check the given property using the given config, and the given test name. - - - - -Check the given property using the given config. - - - - -Check the given property identified by the given MethodInfo. - - - - -Check all public static methods on the given type that have a testable return type with the given configuration. -This includes let-bound functions in a module. - - - - -Check all public static methods on the given type that have a testable return type with the given configuration. -This includes let-bound functions in a module. - - - - - - - -A custom test runner, e.g. to integrate with a test framework like xUnit or NUnit. - - - - -The Arbitrary instances on this class will be merged in back to front order, i.e. instances for the same generated type at the front -of the list will override those at the back. The instances on Arb.Default are always known, and are at the back (so they can always be -overridden) - - - - -What to print every time a counter-example is succesfully shrunk - - - - -What to print when new arguments args are generated in test n - - - - -The size to use for the last test, when all the tests are passing. The size increases linearly between Start- and EndSize. - - - - -The size to use for the first test. - - - - -Name of the test. - - - - -If set, the seed to use to start testing. Allows reproduction of previous runs. - - - - -The maximum number of tests where values are rejected, e.g. as the result of ==> - - - - -The maximum number of tests that are run. - - - - - - - -Like the Verbose configuration, only throws an exception with the error message if the test fails or is exhausted. -Useful for use within other unit testing frameworks that usually adopt this methodolgy to signal failure. - - - - -The verbose configuration prints each generated argument. - - - - -Like the Quick configuration, only throws an exception with the error message if the test fails or is exhausted. -Useful for use within other unit testing frameworks that usually adopt this methodolgy to signal failure. - - - - -The quick configuration only prints a summary result at the end of the test. - - - - -The default configuration is the quick configuration. - - - - -For configuring a run. - - - - - - - -Use the generator for 'a, but don't shrink. - - - - - - - - - - -Whereas most types are restricted by a size that grows -as the test gets further, by applying this type the underlying -type will ignore this size and always generate from the full range. -Note that this only makes a difference for types that have a range - -currently Int16, Int32, Int64 have DontSize Arbitrary instances. -This is typically (and at least currently) only applicable for value types -that are comparable, hence the type constraints. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -map the given function to the value in the generator, yielding a new generator of the result type. - - - - -Generator of a random value, based on a size parameter and a randomly generated int. - - - - - - - - - - - - - - - - - - - -Called before a group of properties on a type are checked. - - - - -Called on a succesful shrink. - - - - -Called whenever all tests are done, either True, False or Exhausted. - - - - -Called whenever arguments are generated and after the test is run. - - - - -For implementing your own test runner. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - determines for which Outcome the result should be shrunk, or shrinking should continue. - - - - - - - - - - - - - - - - - - - -Type synonym for a test result generator. - - - - - - - - - - - - - - - - - - - -Returns a new result that is Succeeded if and only if both this -and the given Result are Succeeded. - - - - -The result of one execution of a property. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Generates (), of the unit type. - - - - - - - - - - -Generates arbitrary strings, which are lists of chars generated by Char. - - - - - - - - - - -Generate an option value that is 'None' 1/8 of the time. - - - - -Generate an object - a boxed char, string or boolean value. - - - - - - - - - - - - - - - - - - - - - - -Generates an interval between two non-negative integers. - - - - - - - -Generate arbitrary int64 that is between -size and size. -Note that since the size is an int32, this does not actually cover the full -range of int64. See DontSize<int64> instead. - - - - -Generate arbitrary int32 that is between -size and size. - - - - -Generate arbitrary int16 that is between -size and size. - - - - -Generate a Function value that can be printed and shrunk. Function values can be generated for types 'a->'b where 'a has a CoArbitrary -value and 'b has an Arbitrary value. - - - - -Generate a list of values. The size of the list is between 0 and the test size + 1. - - - - -Generates arbitrary floats, NaN, NegativeInfinity, PositiveInfinity, Maxvalue, MinValue, Epsilon included fairly frequently. - - - - - - - -Generate arbitrary int64 between Int64.MinValue and Int64.MaxValue - - - - -Generate arbitrary int32 that is between Int32.MinValue and Int32.MaxValue - - - - -Generate arbitrary int16 that is uniformly distributed in the whole range of int16 values. - - - - -Overrides the shrinker of any type to be empty, i.e. not to shrink at all. - - - - -Try to derive an arbitrary instance for the given type reflectively. Works -for record, union, tuple and enum types. - - - - -Generates an arbitrary DateTime between 1900 and 2100. A DateTime is shrunk by removing its second, minute and hour compoonents. - - - - -Generates arbitrary chars, between ASCII codes Char.MinValue and 127. - - - - -Generates an arbitrary byte. - - - - -Generates an arbitrary bool. - - - - -Generate a function value. Function values can be generated for types 'a->'b where 'a has a CoArbitrary -value and 'b has an Arbitrary value. - - - - -Generate a rank 2, zero based array. - - - - -Generate a rank 1 array. - - - - -A collection of default generators. - - - - - Return an Arbitrary instance that is a mapped and filtered version of an existing arbitrary instance. - The generator uses Gen.map with the given mapper and then Gen.suchThat with the given predicate, - and the shrinks are filtered using Seq.filter with the given predicate. -This is sometimes useful if using just a filter would reduce the chance of getting a good value -from the generator - and you can map the value instead. E.g. PositiveInt. - - - - - Return an Arbitrary instance that is a filtered version of an existing arbitrary instance. - The generator uses Gen.suchThat, and the shrinks are filtered using Seq.filter with the given predicate. - - - - -Construct an Arbitrary instance for a type that can be mapped to and from another type (e.g. a wrapper), -based on a Arbitrary instance for the source type and two mapping functions. - - - - - Construct an Arbitrary instance from a generator and shrinker. - - - - - Construct an Arbitrary instance from a generator. - Shrink is not supported for this type. - - - - -Register the generators that are static members of the type argument. - - - - -Register the generators that are static members of the given type. - - - - - - - - - - -The generic shrinker should work for most number-like types. - - - - -Returns the immediate shrinks for the given value based on its type. - - - - -Returns a Gen<'Value> - - - - -Get the Arbitrary instance for the given type. - - - - - - - - - - -Initial state of both object and model. - - - - -Generate a number of possible commands based on the current state of the model. The commands -are just hints to speed up execution; preconditions are still checked. - - - - -A specification for an object under test, based on an abstract model of the -object's behavior. - - - - -Executes the command on the model of the object. - - - - -Excecutes the command on the actual object under test. - - - - - - - -Precondition for execution of the command. - - - - - - - -Postcondition that must hold after execution of the command. - - - - - - - -A single command describes pre and post conditions and the model for a single method under test. - - - - -Turn a specification into a property. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Memoize the given function. - - - - -Memoize the given function using the given dictionary - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Basic co-arbitrary generator transformer, which is dependent on an int. -Only used for generating arbitrary functions. - - - - -Promote the given function f to a function generator. Only used for generating arbitrary functions. - - - - -Apply the given Gen function to the given generator, aka the applicative <*> operator. - - - - -Always generate v. - - - - - Generates a 2D array. The square root of the size is the maximum number of rows and columns. - - - - - Generates a 2D array of the given dimensions. - - - - - Generates an array using the specified generator. The maximum length is the size+1. - - - - - Generates an array of a specified length. - - - - - Generates sublists of the given sequence. - - - - - Generates a non-empty list of random length. The maximum length - depends on the size parameter. - - - - - Generates a list of random length. The maximum length depends on the - size parameter. - - - - -Generates a value that satisfies a predicate. Contrary to suchThatOption, this function keeps re-trying -by increasing the size of the original generator ad infinitum. Make sure there is a high chance that -the predicate is satisfied. - - - - -Tries to generate a value that satisfies a predicate. This function 'gives up' by generating None -if the given original generator did not generate any values that satisfied the predicate, after trying to -get values from by increasing its size. - - - - -Generates a list of given length, containing values generated by the given generator. - - - - -Sequence the given list of generators into a generator of a list. - - - - -Map the given function over values to a function over generators of those values. - - - - -Map the given function over values to a function over generators of those values. - - - - -Build a generator that generates a 4-tuple of the values generated by the given generator. - - - - -Map the given function over values to a function over generators of those values. - - - - -Build a generator that generates a 3-tuple of the values generated by the given generator. - - - - -Map the given function over values to a function over generators of those values. - - - - -Build a generator that generates a 2-tuple of the values generated by the given generator. - - - - -Map the given function over values to a function over generators of those values. - - - - -Build a generator that generates a value from one of the generators in the given non-empty seq, with -given probabilities. The sum of the probabilities must be larger than zero. - - - - -Build a generator that generates a value from one of the generators in the given non-empty seq, with -equal probability. - - - - -Build a generator that randomly generates one of the values in the given non-empty seq. - - - - -Generates an integer between l and h, inclusive. - - - - -Generates a value out of the generator with maximum size n. - - - - -Default generator that generates a random number generator. Useful for starting off the process -of generating a random value. - - - - -Override the current size of the test. resize n g invokes generator g with size parameter n. - - - - -Obtain the current size. sized g calls g, passing it the current size as a parameter. - - - - -Apply ('map') the function f on the value in the generator, yielding a new generator. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -The workflow type for generators. - - - - -The workflow function for generators, e.g. gen { ... } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Like <*>, but puts f in a Gen first. - - - - - Lifted function application = apply f to a, all in the Gen applicative functor. - - - - - - - - Turns a testable type into a property. Testables are unit, boolean, Lazy testables, Gen testables, functions - from a type for which a generator is know to a testable, tuples up to 6 tuple containing testables, and lists - containing testables. - - - - -Fails the property if it does not complete within t milliseconds. Note that the called property gets a -cancel signal, but whether it responds to that is up to the property; the execution may not actually stop. - - - - -Add the given label to the property. The labels of a failing sub-property are displayed when it fails. - - - - -Collect data values property combinator. The argument of collect is evaluated in each test case, -and the distribution of values is reported, using any_to_string. - - - - -Count trivial cases property combinator. Test cases for which the condition is True are classified as trivial. - - - - -Classify test cases combinator. Test cases satisfying the condition are assigned the classification given. - - - - - - - -Expect exception 't when executing p. So, results in success if an exception of the given type is thrown, -and a failure otherwise. - - - - -Depending on the condition, return the first testable if true and the second if false. - - - - -Quantified property combinator. Provide a custom test data generator to a property. - - - - - - - -Construct a property that fails if both fail. (cfr 'or') - - - - -Construct a property that succeeds if both succeed. (cfr 'and') - - - - -Add the given label to the property. label on the left hand side, property on the right. - - - - -Add the given label to the property. Property on the left hand side, label on the right. - - - - -Conditional property combinator. Resulting property holds if the property after ==> holds whenever the condition does. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Equality for generic types - - - - - Get reader for union case name (aka tag) - - - - - Returns the case name, type, and functions that will construct a constructor and a reader of a union type respectively - - - - - Get reader for record type - - - - - Get constructor for record type - - - - - Get information on the fields of a record type - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Builds a generator for the given type based on reflection. Currently works for record and union types. - - - - - - - - - - - Generate a random enum of the type specified by the System.Type - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Force this value to do the necessary initializations of typeclasses. Normally this initialization happens automatically. -In any case, it can be forced any number of times without problem. - - - - -A runner that prints results to the console. - - - - - - - - - - -A function that returns the default string that is printed as a result of the test. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Merge the instances defined by the given instances type with the ones already defined in this TypeClass. -Instances defined in the given type override the instances in this TypeClass instance. - - - - -Get the instance registered on this TypeClass for the given type parameter 'T. The result will be cast -to TypeClassT, which should be 'TypeClass<'T> but that's impossible to express in .NET's type system. - - - - -Get the instance registered on this TypeClass for the given type and optionally the given arguments. -The result is of type 'TypeClass<'T>, dynamically. - - - - -Discover instances for this TypeClass on the given type. Merge the result with this TypeClass, -with the newly discovered instances overriding the instances on this TypeClass. - - - - -Make a new TypeClass with only the instances registered on the given type. -Note that the instances of this TypeClass will not be registered on the new TypeClass. -Use Merge in addition to achieve that, or use DiscoverAndMerge to do both. - - - - -Compares this TypeClass with the given TypeClass. Returns, respectively, the new instances, overridden instances, -new array instances, overridden array instances, new catch all or overridden catchall introduced by the other TypeClass. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Test.RProvider/References/xunit.dll b/Test.RProvider/References/xunit.dll deleted file mode 100644 index bfca6858..00000000 Binary files a/Test.RProvider/References/xunit.dll and /dev/null differ diff --git a/Test.RProvider/References/xunit.xml b/Test.RProvider/References/xunit.xml deleted file mode 100644 index d8b316f5..00000000 --- a/Test.RProvider/References/xunit.xml +++ /dev/null @@ -1,2611 +0,0 @@ - - - - xunit - - - - - Contains various static methods that are used to verify that conditions are met during the - process of running tests. - - - - - Initializes a new instance of the class. - - - - - Verifies that a collection contains a given object. - - The type of the object to be verified - The object expected to be in the collection - The collection to be inspected - Thrown when the object is not present in the collection - - - - Verifies that a collection contains a given object, using an equality comparer. - - The type of the object to be verified - The object expected to be in the collection - The collection to be inspected - The comparer used to equate objects in the collection with the expected object - Thrown when the object is not present in the collection - - - - Verifies that a string contains a given sub-string, using the current culture. - - The sub-string expected to be in the string - The string to be inspected - Thrown when the sub-string is not present inside the string - - - - Verifies that a string contains a given sub-string, using the given comparison type. - - The sub-string expected to be in the string - The string to be inspected - The type of string comparison to perform - Thrown when the sub-string is not present inside the string - - - - Verifies that a collection does not contain a given object. - - The type of the object to be compared - The object that is expected not to be in the collection - The collection to be inspected - Thrown when the object is present inside the container - - - - Verifies that a collection does not contain a given object, using an equality comparer. - - The type of the object to be compared - The object that is expected not to be in the collection - The collection to be inspected - The comparer used to equate objects in the collection with the expected object - Thrown when the object is present inside the container - - - - Verifies that a string does not contain a given sub-string, using the current culture. - - The sub-string which is expected not to be in the string - The string to be inspected - Thrown when the sub-string is present inside the string - - - - Verifies that a string does not contain a given sub-string, using the current culture. - - The sub-string which is expected not to be in the string - The string to be inspected - The type of string comparison to perform - Thrown when the sub-string is present inside the given string - - - - Verifies that a block of code does not throw any exceptions. - - A delegate to the code to be tested - - - - Verifies that a collection is empty. - - The collection to be inspected - Thrown when the collection is null - Thrown when the collection is not empty - - - - Verifies that two objects are equal, using a default comparer. - - The type of the objects to be compared - The expected value - The value to be compared against - Thrown when the objects are not equal - - - - Verifies that two objects are equal, using a custom equatable comparer. - - The type of the objects to be compared - The expected value - The value to be compared against - The comparer used to compare the two objects - Thrown when the objects are not equal - - - - Verifies that two values are equal, within the number of decimal - places given by . - - The expected value - The value to be compared against - The number of decimal places (valid values: 0-15) - Thrown when the values are not equal - - - - Verifies that two values are equal, within the number of decimal - places given by . - - The expected value - The value to be compared against - The number of decimal places (valid values: 0-15) - Thrown when the values are not equal - - - - Verifies that two sequences are equivalent, using a default comparer. - - The type of the objects to be compared - The expected value - The value to be compared against - Thrown when the objects are not equal - - - - Verifies that two sequences are equivalent, using a custom equatable comparer. - - The type of the objects to be compared - The expected value - The value to be compared against - The comparer used to compare the two objects - Thrown when the objects are not equal - - - Do not call this method. - - - - Verifies that the condition is false. - - The condition to be tested - Thrown if the condition is not false - - - - Verifies that the condition is false. - - The condition to be tested - The message to show when the condition is not false - Thrown if the condition is not false - - - - Verifies that a value is within a given range. - - The type of the value to be compared - The actual value to be evaluated - The (inclusive) low value of the range - The (inclusive) high value of the range - Thrown when the value is not in the given range - - - - Verifies that a value is within a given range, using a comparer. - - The type of the value to be compared - The actual value to be evaluated - The (inclusive) low value of the range - The (inclusive) high value of the range - The comparer used to evaluate the value's range - Thrown when the value is not in the given range - - - - Verifies that an object is of the given type or a derived type. - - The type the object should be - The object to be evaluated - The object, casted to type T when successful - Thrown when the object is not the given type - - - - Verifies that an object is of the given type or a derived type. - - The type the object should be - The object to be evaluated - Thrown when the object is not the given type - - - - Verifies that an object is not exactly the given type. - - The type the object should not be - The object to be evaluated - Thrown when the object is the given type - - - - Verifies that an object is not exactly the given type. - - The type the object should not be - The object to be evaluated - Thrown when the object is the given type - - - - Verifies that an object is exactly the given type (and not a derived type). - - The type the object should be - The object to be evaluated - The object, casted to type T when successful - Thrown when the object is not the given type - - - - Verifies that an object is exactly the given type (and not a derived type). - - The type the object should be - The object to be evaluated - Thrown when the object is not the given type - - - - Verifies that a collection is not empty. - - The collection to be inspected - Thrown when a null collection is passed - Thrown when the collection is empty - - - - Verifies that two objects are not equal, using a default comparer. - - The type of the objects to be compared - The expected object - The actual object - Thrown when the objects are equal - - - - Verifies that two objects are not equal, using a custom equality comparer. - - The type of the objects to be compared - The expected object - The actual object - The comparer used to examine the objects - Thrown when the objects are equal - - - - Verifies that two sequences are not equivalent, using a default comparer. - - The type of the objects to be compared - The expected object - The actual object - Thrown when the objects are equal - - - - Verifies that two sequences are not equivalent, using a custom equality comparer. - - The type of the objects to be compared - The expected object - The actual object - The comparer used to compare the two objects - Thrown when the objects are equal - - - - Verifies that a value is not within a given range, using the default comparer. - - The type of the value to be compared - The actual value to be evaluated - The (inclusive) low value of the range - The (inclusive) high value of the range - Thrown when the value is in the given range - - - - Verifies that a value is not within a given range, using a comparer. - - The type of the value to be compared - The actual value to be evaluated - The (inclusive) low value of the range - The (inclusive) high value of the range - The comparer used to evaluate the value's range - Thrown when the value is in the given range - - - - Verifies that an object reference is not null. - - The object to be validated - Thrown when the object is not null - - - - Verifies that two objects are not the same instance. - - The expected object instance - The actual object instance - Thrown when the objects are the same instance - - - - Verifies that an object reference is null. - - The object to be inspected - Thrown when the object reference is not null - - - - Verifies that the provided object raised INotifyPropertyChanged.PropertyChanged - as a result of executing the given test code. - - The object which should raise the notification - The property name for which the notification should be raised - The test code which should cause the notification to be raised - Thrown when the notification is not raised - - - - Verifies that two objects are the same instance. - - The expected object instance - The actual object instance - Thrown when the objects are not the same instance - - - - Verifies that the given collection contains only a single - element of the given type. - - The collection. - The single item in the collection. - Thrown when the collection does not contain - exactly one element. - - - - Verifies that the given collection contains only a single - element of the given value. The collection may or may not - contain other values. - - The collection. - The value to find in the collection. - The single item in the collection. - Thrown when the collection does not contain - exactly one element. - - - - Verifies that the given collection contains only a single - element of the given type. - - The collection type. - The collection. - The single item in the collection. - Thrown when the collection does not contain - exactly one element. - - - - Verifies that the given collection contains only a single - element of the given type which matches the given predicate. The - collection may or may not contain other values which do not - match the given predicate. - - The collection type. - The collection. - The item matching predicate. - The single item in the filtered collection. - Thrown when the filtered collection does - not contain exactly one element. - - - - Verifies that the exact exception is thrown (and not a derived exception type). - - The type of the exception expected to be thrown - A delegate to the code to be tested - The exception that was thrown, when successful - Thrown when an exception was not thrown, or when an exception of the incorrect type is thrown - - - - Verifies that the exact exception is thrown (and not a derived exception type). - Generally used to test property accessors. - - The type of the exception expected to be thrown - A delegate to the code to be tested - The exception that was thrown, when successful - Thrown when an exception was not thrown, or when an exception of the incorrect type is thrown - - - - Verifies that the exact exception is thrown (and not a derived exception type). - - The type of the exception expected to be thrown - A delegate to the code to be tested - The exception that was thrown, when successful - Thrown when an exception was not thrown, or when an exception of the incorrect type is thrown - - - - Verifies that the exact exception is thrown (and not a derived exception type). - Generally used to test property accessors. - - The type of the exception expected to be thrown - A delegate to the code to be tested - The exception that was thrown, when successful - Thrown when an exception was not thrown, or when an exception of the incorrect type is thrown - - - - Verifies that an expression is true. - - The condition to be inspected - Thrown when the condition is false - - - - Verifies that an expression is true. - - The condition to be inspected - The message to be shown when the condition is false - Thrown when the condition is false - - - - Used by the PropertyChanged. - - - - - Used by the Throws and DoesNotThrow methods. - - - - - Used by the Throws and DoesNotThrow methods. - - - - - This command sets up the necessary trace listeners and standard - output/error listeners to capture Assert/Debug.Trace failures, - output to stdout/stderr, and Assert/Debug.Write text. It also - captures any exceptions that are thrown and packages them as - FailedResults, including the possibility that the configuration - file is messed up (which is exposed when we attempt to manipulate - the trace listener list). - - - - - Base class used by commands which delegate to inner commands. - - - - - Interface which represents the ability to invoke of a test method. - - - - - Executes the test method. - - The instance of the test class - Returns information about the test run - - - - Creates the start XML to be sent to the callback when the test is about to start - running. - - Return the of the start node, or null if the test - is known that it will not be running. - - - - Gets the display name of the test method. - - - - - Determines if the test runner infrastructure should create a new instance of the - test class before running the test. - - - - - Determines if the test should be limited to running a specific amount of time - before automatically failing. - - The timeout value, in milliseconds; if zero, the test will not have - a timeout. - - - - Creates a new instance of the class. - - The inner command to delegate to. - - - - - - - - - - - - - - - - - - - - - - Initializes a new instance of the - class. - - The command that will be wrapped. - The test method. - - - - - - - Represents an implementation of to be used with - tests which are decorated with the . - - - - - Represents an xUnit.net test command. - - - - - The method under test. - - - - - Initializes a new instance of the class. - - The method under test. - The display name of the test. - The timeout, in milliseconds. - - - - - - - - - - - - - Gets the name of the method under test. - - - - - - - - - - - Gets the name of the type under test. - - - - - Initializes a new instance of the class. - - The test method. - - - - - - - Base class for exceptions that have actual and expected values - - - - - The base assert exception class - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class. - - The user message to be displayed - - - - Initializes a new instance of the class. - - The user message to be displayed - The inner exception - - - - Initializes a new instance of the class. - - The user message to be displayed - The stack trace to be displayed - - - - - - - Determines whether to exclude a line from the stack frame. By default, this method - removes all stack frames from methods beginning with Xunit.Assert or Xunit.Sdk. - - The stack frame to be filtered. - Return true to exclude the line from the stack frame; false, otherwise. - - - - Filters the stack trace to remove all lines that occur within the testing framework. - - The original stack trace - The filtered stack trace - - - - - - - Gets a string representation of the frames on the call stack at the time the current exception was thrown. - - A string that describes the contents of the call stack, with the most recent method call appearing first. - - - - Gets the user message - - - - - Creates a new instance of the class. - - The expected value - The actual value - The user message to be shown - - - - Creates a new instance of the class. - - The expected value - The actual value - The user message to be shown - Set to true to skip the check for difference position - - - - - - - - - - Gets the actual value. - - - - - Gets the expected value. - - - - - Gets a message that describes the current exception. Includes the expected and actual values. - - The error message that explains the reason for the exception, or an empty string(""). - 1 - - - - Exception thrown when a collection unexpectedly does not contain the expected value. - - - - - Creates a new instance of the class. - - The expected object value - - - - Creates a new instance of the class. - - The expected object value - The actual value - - - - - - - Exception to be thrown from when the number of - parameter values does not the test method signature. - - - - - - - - - - - Exception thrown when code unexpectedly fails change a property. - - - - - Creates a new instance of the class. Call this constructor - when no exception was thrown. - - The name of the property that was expected to be changed. - - - - - - - Exception thrown when the collection did not contain exactly one element. - - - - - Initializes a new instance of the class. - - The numbers of items in the collection. - - - - Initializes a new instance of the class. - - The numbers of items in the collection. - The object expected to be in the collection. - - - - - - - Internal class used for version-resilient test runners. DO NOT CALL DIRECTLY. - Version-resilient runners should link against xunit.runner.utility.dll and use - ExecutorWrapper instead. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Exception thrown when the value is unexpectedly not of the given type or a derived type. - - - - - Creates a new instance of the class. - - The expected type - The actual object value - - - - - - - Allows the user to record actions for a test. - - - - - Records any exception which is thrown by the given code. - - The code which may thrown an exception. - Returns the exception that was thrown by the code; null, otherwise. - - - - Records any exception which is thrown by the given code that has - a return value. Generally used for testing property accessors. - - The code which may thrown an exception. - Returns the exception that was thrown by the code; null, otherwise. - - - - Exception that is thrown when one or more exceptions are thrown from - the After method of a . - - - - - Initializes a new instance of the class. - - The exceptions. - - - - Initializes a new instance of the class. - - The exceptions. - - - - - - - - - - Gets the list of exceptions thrown in the After method. - - - - - Gets a message that describes the current exception. - - - - - Gets a string representation of the frames on the call stack at the time the current exception was thrown. - - - - - Implementation of which executes the - instances attached to a test method. - - - - - Initializes a new instance of the class. - - The inner command. - The method. - - - - Executes the test method. - - The instance of the test class - Returns information about the test run - - - - This class supports the xUnit.net infrastructure and is not intended to be used - directly from your code. - - - - - This API supports the xUnit.net infrastructure and is not intended to be used - directly from your code. - - - - - This API supports the xUnit.net infrastructure and is not intended to be used - directly from your code. - - - - - This API supports the xUnit.net infrastructure and is not intended to be used - directly from your code. - - - - - Guard class, used for guard clauses and argument validation - - - - - - - - - - - - - - Base class which contains XML manipulation helper methods - - - - - Interface that represents a single test result. - - - - - Converts the test result into XML that is consumed by the test runners. - - The parent node. - The newly created XML node. - - - - The amount of time spent in execution - - - - - Adds the test execution time to the XML node. - - The XML node. - - - - - - - - - - Utility methods for dealing with exceptions. - - - - - Gets the message for the exception, including any inner exception messages. - - The exception - The formatted message - - - - Gets the stack trace for the exception, including any inner exceptions. - - The exception - The formatted stack trace - - - - Rethrows an exception object without losing the existing stack trace information - - The exception to re-throw. - - For more information on this technique, see - http://www.dotnetjunkies.com/WebLog/chris.taylor/archive/2004/03/03/8353.aspx - - - - - A dictionary which contains multiple unique values for each key. - - The type of the key. - The type of the value. - - - - Adds the value for the given key. If the key does not exist in the - dictionary yet, it will add it. - - The key. - The value. - - - - Removes all keys and values from the dictionary. - - - - - Determines whether the dictionary contains to specified key and value. - - The key. - The value. - - - - Calls the delegate once for each key/value pair in the dictionary. - - - - - Removes the given key and all of its values. - - - - - Removes the given value from the given key. If this was the - last value for the key, then the key is removed as well. - - The key. - The value. - - - - Gets the values for the given key. - - - - - Gets the count of the keys in the dictionary. - - - - - Gets the keys. - - - - - - - - XML utility methods - - - - - Adds an attribute to an XML node. - - The XML node. - The attribute name. - The attribute value. - - - - Adds a child element to an XML node. - - The parent XML node. - The child element name. - The new child XML element. - - - - Sets the inner text of the XML node, properly escaping it as necessary. - - The element whose inner text will be set. - The inner text to be escaped and then set. - - - - Exception that is thrown when a call to Debug.Assert() fails. - - - - - Creates a new instance of the class. - - The original assert message - - - - Creates a new instance of the class. - - The original assert message - The original assert detailed message - - - - - - - - - - Gets the original assert detailed message. - - - - - Gets the original assert message. - - - - - Gets a message that describes the current exception. - - - - - Exception thrown when a collection unexpectedly contains the expected value. - - - - - Creates a new instance of the class. - - The expected object value - - - - - - - Exception thrown when code unexpectedly throws an exception. - - - - - Creates a new instance of the class. - - Actual exception - - - - THIS CONSTRUCTOR IS FOR UNIT TESTING PURPOSES ONLY. - - - - - - - - - - - Gets a string representation of the frames on the call stack at the time the current exception was thrown. - - A string that describes the contents of the call stack, with the most recent method call appearing first. - - - - Exception thrown when a collection is unexpectedly not empty. - - - - - Creates a new instance of the class. - - - - - - - - Exception thrown when two values are unexpectedly not equal. - - - - - Creates a new instance of the class. - - The expected object value - The actual object value - - - - Creates a new instance of the class. - - The expected object value - The actual object value - Set to true to skip the check for difference position - - - - - - - Exception thrown when a value is unexpectedly true. - - - - - Creates a new instance of the class. - - The user message to be display, or null for the default message - - - - - - - Exception thrown when a value is unexpectedly not in the given range. - - - - - Creates a new instance of the class. - - The actual object value - The low value of the range - The high value of the range - - - - - - - - - - Gets the actual object value - - - - - Gets the high value of the range - - - - - Gets the low value of the range - - - - - Gets a message that describes the current exception. - - The error message that explains the reason for the exception, or an empty string(""). - - - - Exception thrown when the value is unexpectedly of the exact given type. - - - - - Creates a new instance of the class. - - The expected type - The actual object value - - - - - - - Exception thrown when the value is unexpectedly not of the exact given type. - - - - - Creates a new instance of the class. - - The expected type - The actual object value - - - - - - - Used to decorate xUnit.net test classes that utilize fixture classes. - An instance of the fixture data is initialized just before the first - test in the class is run, and if it implements IDisposable, is disposed - after the last test in the class is run. - - The type of the fixture - - - - Called on the test class just before each test method is run, - passing the fixture data so that it can be used for the test. - All test runs share the same instance of fixture data. - - The fixture data - - - - Exception thrown when a value is unexpectedly in the given range. - - - - - Creates a new instance of the class. - - The actual object value - The low value of the range - The high value of the range - - - - - - - - - - Gets the actual object value - - - - - Gets the high value of the range - - - - - Gets the low value of the range - - - - - Gets a message that describes the current exception. - - The error message that explains the reason for the exception, or an empty string(""). - - - - Base attribute which indicates a test method interception (allows code to be run before and - after the test is run). - - - - - This method is called after the test method is executed. - - The method under test - - - - This method is called before the test method is executed. - - The method under test - - - - - - - Exception thrown when a collection is unexpectedly empty. - - - - - Creates a new instance of the class. - - - - - - - - Exception thrown when two values are unexpectedly equal. - - - - - Creates a new instance of the class. - - - - - - - - Exception thrown when an object is unexpectedly null. - - - - - Creates a new instance of the class. - - - - - - - - Exception thrown when two values are unexpected the same instance. - - - - - Creates a new instance of the class. - - - - - - - - Exception thrown when an object reference is unexpectedly not null. - - - - - Creates a new instance of the class. - - - - - - - - - Command that automatically creates the instance of the test class - and disposes it (if it implements ). - - - - - Creates a new instance of the object. - - The command that is bring wrapped - The method under test - - - - Executes the test method. Creates a new instance of the class - under tests and passes it to the inner command. Also catches - any exceptions and converts them into s. - - The instance of the test class - Returns information about the test run - - - - Command used to wrap a which has associated - fixture data. - - - - - Creates a new instance of the class. - - The inner command - The fixtures to be set on the test class - - - - Sets the fixtures on the test class by calling SetFixture, then - calls the inner command. - - The instance of the test class - Returns information about the test run - - - - A timer class used to figure out how long tests take to run. On most .NET implementations - this will use the class because it's a high - resolution timer; however, on Silverlight/CoreCLR, it will use - (which will provide lower resolution results). - - - - - Creates a new instance of the class. - - - - - Starts timing. - - - - - Stops timing. - - - - - Gets how long the timer ran, in milliseconds. In order for this to be valid, - both and must have been called. - - - - - Attribute used to decorate a test method with arbitrary name/value pairs ("traits"). - - - - - Creates a new instance of the class. - - The trait name - The trait value - - - - Gets the trait name. - - - - - - - - Gets the trait value. - - - - - Runner that executes an synchronously. - - - - - Execute the . - - The test class command to execute - The methods to execute; if null or empty, all methods will be executed - The start run callback - The end run result callback - A with the results of the test run - - - - Factory for objects, based on the type under test. - - - - - Creates the test class command, which implements , for a given type. - - The type under test - The test class command, if the class is a test class; null, otherwise - - - - Creates the test class command, which implements , for a given type. - - The type under test - The test class command, if the class is a test class; null, otherwise - - - - Represents an xUnit.net test class - - - - - Interface which describes the ability to executes all the tests in a test class. - - - - - Allows the test class command to choose the next test to be run from the list of - tests that have not yet been run, thereby allowing it to choose the run order. - - The tests remaining to be run - The index of the test that should be run - - - - Execute actions to be run after all the test methods of this test class are run. - - Returns the thrown during execution, if any; null, otherwise - - - - Execute actions to be run before any of the test methods of this test class are run. - - Returns the thrown during execution, if any; null, otherwise - - - - Enumerates the test commands for a given test method in this test class. - - The method under test - The test commands for the given test method - - - - Enumerates the methods which are test methods in this test class. - - The test methods - - - - Determines if a given refers to a test method. - - The test method to validate - True if the method is a test method; false, otherwise - - - - Gets the object instance that is under test. May return null if you wish - the test framework to create a new object instance for each test method. - - - - - Gets or sets the type that is being tested - - - - - Creates a new instance of the class. - - - - - Creates a new instance of the class. - - The type under test - - - - Creates a new instance of the class. - - The type under test - - - - Chooses the next test to run, randomly, using the . - - The tests remaining to be run - The index of the test that should be run - - - - Execute actions to be run after all the test methods of this test class are run. - - Returns the thrown during execution, if any; null, otherwise - - - - Execute actions to be run before any of the test methods of this test class are run. - - Returns the thrown during execution, if any; null, otherwise - - - - Enumerates the test commands for a given test method in this test class. - - The method under test - The test commands for the given test method - - - - Enumerates the methods which are test methods in this test class. - - The test methods - - - - Determines if a given refers to a test method. - - The test method to validate - True if the method is a test method; false, otherwise - - - - Gets the object instance that is under test. May return null if you wish - the test framework to create a new object instance for each test method. - - - - - Gets or sets the randomizer used to determine the order in which tests are run. - - - - - Sets the type that is being tested - - - - - Implementation of that represents a skipped test. - - - - - Creates a new instance of the class. - - The method that is being skipped - The display name for the test. If null, the fully qualified - type name is used. - The reason the test was skipped. - - - - - - - - - - Gets the skip reason. - - - - - - - - Factory for creating objects. - - - - - Make instances of objects for the given class and method. - - The class command - The method under test - The set of objects - - - - A command wrapper which times the running of a command. - - - - - Creates a new instance of the class. - - The command that will be timed. - - - - Executes the inner test method, gathering the amount of time it takes to run. - - Returns information about the test run - - - - Wraps a command which should fail if it runs longer than the given timeout value. - - - - - Creates a new instance of the class. - - The command to be run - The timout, in milliseconds - The method under test - - - - Executes the test method, failing if it takes too long. - - Returns information about the test run - - - - - - - Attributes used to decorate a test fixture that is run with an alternate test runner. - The test runner must implement the interface. - - - - - Creates a new instance of the class. - - The class which implements ITestClassCommand and acts as the runner - for the test fixture. - - - - Gets the test class command. - - - - - Exception thrown when two object references are unexpectedly not the same instance. - - - - - Creates a new instance of the class. - - The expected object reference - The actual object reference - - - - - - - Contains the test results from an assembly. - - - - - Contains multiple test results, representing them as a composite test result. - - - - - Adds a test result to the composite test result list. - - - - - - Gets the test results. - - - - - Creates a new instance of the class. - - The filename of the assembly - - - - Creates a new instance of the class. - - The filename of the assembly - The configuration filename - - - - Converts the test result into XML that is consumed by the test runners. - - The parent node. - The newly created XML node. - - - - Gets the fully qualified filename of the configuration file. - - - - - Gets the directory where the assembly resides. - - - - - Gets the number of failed results. - - - - - Gets the fully qualified filename of the assembly. - - - - - Gets the number of passed results. - - - - - Gets the number of skipped results. - - - - - Contains the test results from a test class. - - - - - Creates a new instance of the class. - - The type under test - - - - Creates a new instance of the class. - - The simple name of the type under test - The fully qualified name of the type under test - The namespace of the type under test - - - - Sets the exception thrown by the test fixture. - - The thrown exception - - - - Converts the test result into XML that is consumed by the test runners. - - The parent node. - The newly created XML node. - - - - Gets the fully qualified test fixture exception type, when an exception has occurred. - - - - - Gets the number of tests which failed. - - - - - Gets the fully qualified name of the type under test. - - - - - Gets the test fixture exception message, when an exception has occurred. - - - - - Gets the simple name of the type under test. - - - - - Gets the namespace of the type under test. - - - - - Gets the number of tests which passed. - - - - - Gets the number of tests which were skipped. - - - - - Gets the test fixture exception stack trace, when an exception has occurred. - - - - - Represents a failed test result. - - - - - Represents the results from running a test method - - - - - Initializes a new instance of the class. The traits for - the test method are discovered using reflection. - - The method under test. - The display name for the test. If null, the fully qualified - type name is used. - - - - Initializes a new instance of the class. - - The name of the method under test. - The type of the method under test. - The display name for the test. If null, the fully qualified - type name is used. - The traits. - - - - Converts the test result into XML that is consumed by the test runners. - - The parent node. - The newly created XML node. - - - - Gets or sets the display name of the method under test. This is the value that's shown - during failures and in the resulting output XML. - - - - - Gets the name of the method under test. - - - - - Gets or sets the standard output/standard error from the test that was captured - while the test was running. - - - - - Gets the traits attached to the test method. - - - - - Gets the name of the type under test. - - - - - Creates a new instance of the class. - - The method under test - The exception throw by the test - The display name for the test. If null, the fully qualified - type name is used. - - - - Creates a new instance of the class. - - The name of the method under test - The name of the type under test - The display name of the test - The custom properties attached to the test method - The full type name of the exception throw - The exception message - The exception stack trace - - - - Converts the test result into XML that is consumed by the test runners. - - The parent node. - The newly created XML node. - - - - Gets the exception type thrown by the test method. - - - - - Gets the exception message thrown by the test method. - - - - - Gets the stack trace of the exception thrown by the test method. - - - - - Represents a passing test result. - - - - - Create a new instance of the class. - - The method under test - The display name for the test. If null, the fully qualified - type name is used. - - - - Create a new instance of the class. - - The name of the method under test - The name of the type under test - The display name for the test. If null, the fully qualified - type name is used. - The custom properties attached to the test method - - - - Converts the test result into XML that is consumed by the test runners. - - The parent node. - The newly created XML node. - - - - Represents a skipped test result. - - - - - Creates a new instance of the class. Uses reflection to discover - the skip reason. - - The method under test - The display name for the test. If null, the fully qualified - type name is used. - The reason the test was skipped. - - - - Creates a new instance of the class. - - The name of the method under test - The name of the type under test - The display name for the test. If null, the fully qualified - type name is used. - The traits attached to the method under test - The skip reason - - - - Converts the test result into XML that is consumed by the test runners. - - The parent node. - The newly created XML node. - - - - Gets the skip reason. - - - - - Represents information about an attribute. - - - - - Gets the instance of the attribute, if available. - - The type of the attribute - The instance of the attribute, if available. - - - - Gets an initialized property value of the attribute. - - The type of the property - The name of the property - The property value - - - - Represents information about a method. - - - - - Creates an instance of the type where this test method was found. If using - reflection, this should be the ReflectedType. - - A new instance of the type. - - - - Gets all the custom attributes for the method that are of the given type. - - The type of the attribute - The matching attributes that decorate the method - - - - Determines if the method has at least one instance of the given attribute type. - - The type of the attribute - True if the method has at least one instance of the given attribute type; false, otherwise - - - - Invokes the test on the given class, with the given parameters. - - The instance of the test class (may be null if - the test method is static). - The parameters to be passed to the test method. - - - - Gets a value which represents the class that this method was - reflected from (i.e., equivalent to MethodInfo.ReflectedType) - - - - - Gets a value indicating whether the method is abstract. - - - - - Gets a value indicating whether the method is static. - - - - - Gets the underlying for the method, if available. - - - - - Gets the name of the method. - - - - - Gets the fully qualified type name of the return type. - - - - - Gets the fully qualified type name of the type that this method belongs to. If - using reflection, this should be the ReflectedType. - - - - - Represents information about a type. - - - - - Gets all the custom attributes for the type that are of the given attribute type. - - The type of the attribute - The matching attributes that decorate the type - - - - Gets a test method by name. - - The name of the method - The method, if it exists; null, otherwise. - - - - Gets all the methods - - - - - - Determines if the type has at least one instance of the given attribute type. - - The type of the attribute - True if the type has at least one instance of the given attribute type; false, otherwise - - - - Determines if the type implements the given interface. - - The type of the interface - True if the type implements the given interface; false, otherwise - - - - Gets a value indicating whether the type is abstract. - - - - - Gets a value indicating whether the type is sealed. - - - - - Gets the underlying object, if available. - - - - - Utility class which inspects methods for test information - - - - - Gets the display name. - - The method to be inspected - The display name - - - - Gets the skip reason from a test method. - - The method to be inspected - The skip reason - - - - Gets the test commands for a test method. - - The method to be inspected - The objects for the test method - - - - Gets the timeout value for a test method. - - The method to be inspected - The timeout, in milliseconds - - - - Gets the traits on a test method. - - The method to be inspected - A dictionary of the traits - - - - Determines whether a test method has a timeout. - - The method to be inspected - True if the method has a timeout; false, otherwise - - - - Determines whether a test method has traits. - - The method to be inspected - True if the method has traits; false, otherwise - - - - Determines whether a test method should be skipped. - - The method to be inspected - True if the method should be skipped; false, otherwise - - - - Determines whether a method is a test method. A test method must be decorated - with the (or derived class) and must not be abstract. - - The method to be inspected - True if the method is a test method; false, otherwise - - - - Wrapper to implement and using reflection. - - - - - Converts an into an using reflection. - - - - - - - Converts a into an using reflection. - - The method to wrap - The wrapper - - - - Converts a into an using reflection. - - The type to wrap - The wrapper - - - - Utility class which inspects types for test information - - - - - Determines if a type contains any test methods - - The type to be inspected - True if the class contains any test methods; false, otherwise - - - - Retrieves the type to run the test class with from the , if present. - - The type to be inspected - The type of the test class runner, if present; null, otherwise - - - - Retrieves a list of the test methods from the test class. - - The type to be inspected - The test methods - - - - Determines if the test class has a applied to it. - - The type to be inspected - True if the test class has a run with attribute; false, otherwise - - - - Determines if the type implements . - - The type to be inspected - True if the type implements ; false, otherwise - - - - Determines whether the specified type is abstract. - - The type. - - true if the specified type is abstract; otherwise, false. - - - - - Determines whether the specified type is static. - - The type. - - true if the specified type is static; otherwise, false. - - - - - Determines if a class is a test class. - - The type to be inspected - True if the type is a test class; false, otherwise - - - - Attribute that is applied to a method to indicate that it is a fact that should be run - by the test runner. It can also be extended to support a customized definition of a - test method. - - - - - Creates instances of which represent individual intended - invocations of the test method. - - The method under test - An enumerator through the desired test method invocations - - - - Enumerates the test commands represented by this test method. Derived classes should - override this method to return instances of , one per execution - of a test method. - - The test method - The test commands which will execute the test runs for the given method - - - - Gets the name of the test to be used when the test is skipped. Defaults to - null, which will cause the fully qualified test name to be used. - - - - - Obsolete. Please use the property instead. - - - - - Marks the test so that it will not be run, and gets or sets the skip reason - - - - - Marks the test as failing if it does not finish running within the given time - period, in milliseconds; set to 0 or less to indicate the method has no timeout - - - - - Exception thrown when code unexpectedly fails to throw an exception. - - - - - Creates a new instance of the class. Call this constructor - when no exception was thrown. - - The type of the exception that was expected - - - - Creates a new instance of the class. Call this constructor - when an exception of the wrong type was thrown. - - The type of the exception that was expected - The actual exception that was thrown - - - - - - - THIS CONSTRUCTOR IS FOR UNIT TESTING PURPOSES ONLY. - - - - - - - - Gets a string representation of the frames on the call stack at the time the current exception was thrown. - - A string that describes the contents of the call stack, with the most recent method call appearing first. - - - - Exception thrown when a test method exceeds the given timeout value - - - - - Creates a new instance of the class. - - The timeout value, in milliseconds - - - - - - - Exception thrown when a value is unexpectedly false. - - - - - Creates a new instance of the class. - - The user message to be displayed, or null for the default message - - - - - - diff --git a/Tools/build.fsx b/Tools/build.fsx new file mode 100755 index 00000000..6b5e0c5a --- /dev/null +++ b/Tools/build.fsx @@ -0,0 +1,38 @@ +// -------------------------------------------------------------------------------------- +// Builds the documentation from FSX files in the 'samples' directory +// (the documentation is stored in the 'docs' directory) +// -------------------------------------------------------------------------------------- + +#I "../packages/FSharp.Formatting.2.0.1/lib/net40" +#r "FSharp.Literate.dll" +#r "FSharp.CodeFormat.dll" +open System.IO +open FSharp.Literate + +let (++) a b = Path.Combine(a, b) +let template = __SOURCE_DIRECTORY__ ++ "template.html" +let sources = __SOURCE_DIRECTORY__ ++ "../docs" +let output = __SOURCE_DIRECTORY__ ++ "../generated" + +// Root URL for the generated HTML +let root = "http://tpetricek.github.io/FSharp.RProvider" // TODO: Move under Blue Mountain! +// Root URL for local testing +// let root = "file://C:\dev\FSharp.RProvider\generated" + +// Generate HTML from all FSX files in samples & subdirectories +let build () = + // Copy all sample data files to the "data" directory + let copy = [ sources ++ "../packages/FSharp.Formatting.2.0.1/literate/content", output ++ "content" + sources ++ "img", output ++ "img" + sources ++ "misc", output ++ "misc" ] + for source, target in copy do + if Directory.Exists target then Directory.Delete(target, true) + Directory.CreateDirectory target |> ignore + for fileInfo in DirectoryInfo(source).EnumerateFiles() do + fileInfo.CopyTo(target ++ fileInfo.Name) |> ignore + + Literate.ProcessDirectory + ( sources, template, output, + replacements = [ "root", root ] ) + +build() \ No newline at end of file diff --git a/Tools/template.html b/Tools/template.html new file mode 100755 index 00000000..4603eef6 --- /dev/null +++ b/Tools/template.html @@ -0,0 +1,71 @@ + + + + + {page-title} + + + + + + + + + + + + + + + +
+
+ +

R Type Provider

+
+
+ +
+ Fork me on GitHub + + \ No newline at end of file diff --git a/build.cmd b/build.cmd new file mode 100644 index 00000000..fdddf6a5 --- /dev/null +++ b/build.cmd @@ -0,0 +1,7 @@ +@echo off +cls +if not exist tools\FAKE\tools\Fake.exe ( + .nuget\nuget.exe install FAKE -OutputDirectory tools -ExcludeVersion -Prerelease +) +tools\FAKE\tools\FAKE.exe build.fsx %* +pause \ No newline at end of file diff --git a/build.fsx b/build.fsx new file mode 100644 index 00000000..de930f71 --- /dev/null +++ b/build.fsx @@ -0,0 +1,189 @@ +// -------------------------------------------------------------------------------------- +// FAKE build script +// -------------------------------------------------------------------------------------- + +#r "tools/FAKE/tools/FakeLib.dll" +open System +open System.IO +open Fake +open Fake.Git +open Fake.AssemblyInfoFile + +Environment.CurrentDirectory <- __SOURCE_DIRECTORY__ + +let files includes = + { BaseDirectories = [__SOURCE_DIRECTORY__] + Includes = includes + Excludes = [] } |> Scan + +// Information about the project to be used at NuGet and in AssemblyInfo files +let projectName = "RProvider" +let projectSummary = "An F# Type Provider providing strongly typed access to the R statistical package." +let projectDescription = """ + An F# Type Provider providing strongly typed access to the R statistical package. + The type provider automatically discovers available R packages and makes them + easily accessible from F#, so you can easily call powerful packages and + visualization libraries from code running on the .NET platform.""" +let authors = ["BlueMountain Capital"] +let companyName = "BlueMountain Capital" +let tags = "F# fsharp R TypeProvider visualization statistics" + +// Read additional information from the release notes document +// Expected format: "0.9.0-beta - Foo bar." or just "0.9.0 - Foo bar." +// (We need to extract just the number for AssemblyInfo & all version for NuGet +let versionAsm, versionNuGet, releaseNotes = + let lastItem = File.ReadLines "RELEASE_NOTES.md" |> Seq.last + let firstDash = lastItem.IndexOf(" - ") + let notes = lastItem.Substring(firstDash + 2).Trim() + let version = lastItem.Substring(0, firstDash).Trim([|'*'|]).Trim() + // Get just numeric version, if it contains dash + let versionDash = version.IndexOf('-') + if versionDash = -1 then version, version, notes + else version.Substring(0, versionDash), version, notes + +// -------------------------------------------------------------------------------------- +// Generate assembly info files with the right version & up-to-date information + +Target "AssemblyInfo" (fun _ -> + let fileName = "src/Common/AssemblyInfo.fs" + CreateFSharpAssemblyInfo fileName + [ Attribute.Title projectName + Attribute.Company companyName + Attribute.Product projectName + Attribute.Description projectSummary + Attribute.Version versionAsm + Attribute.FileVersion versionAsm ] +) + +// -------------------------------------------------------------------------------------- +// Clean build results & restore NuGet packages + +Target "RestorePackages" (fun _ -> + !! "./**/packages.config" + |> Seq.iter (RestorePackage (fun p -> { p with ToolPath = "./.nuget/NuGet.exe" })) +) + +Target "Clean" (fun _ -> + CleanDirs ["build"; "gh-pages"; "release" ] +) + +Target "CleanDocs" (fun _ -> + CleanDirs ["generated"] +) + +// -------------------------------------------------------------------------------------- +// Build library & test project + +Target "Build" (fun _ -> + (files ["RProvider.sln"; "RProvider.Tests.sln"]) + |> MSBuildRelease "" "Rebuild" + |> Log "AppBuild-Output: " +) + +// -------------------------------------------------------------------------------------- +// Run the unit tests using test runner & kill test runner when complete +// +// TODO: The tests are using xUnit, so tests are not run as part of FAKE currently :-( +// +(* + +Target "RunTests" (fun _ -> + let nunitVersion = GetPackageVersion "packages" "NUnit.Runners" + let nunitPath = sprintf "packages/NUnit.Runners.%s/Tools" nunitVersion + + ActivateFinalTarget "CloseTestRunner" + + (files ["tests/*/bin/Release/Test.RProvider.dll"]) + |> NUnit (fun p -> + { p with + ToolPath = nunitPath + DisableShadowCopy = true + TimeOut = TimeSpan.FromMinutes 20. + OutputFile = "TestResults.xml" }) +) + +FinalTarget "CloseTestRunner" (fun _ -> + ProcessHelper.killProcess "nunit-agent.exe" +) +*) +Target "RunTests" DoNothing + +// -------------------------------------------------------------------------------------- +// Build a NuGet package + +Target "NuGet" (fun _ -> + // Format the description to fit on a single line (remove \r\n and double-spaces) + let projectDescription = projectDescription.Replace("\r", "").Replace("\n", "").Replace(" ", " ") + let nugetPath = ".nuget/nuget.exe" + NuGet (fun p -> + { p with + Authors = authors + Project = projectName + Summary = projectSummary + Description = projectDescription + Version = versionNuGet + ReleaseNotes = releaseNotes + Tags = tags + OutputPath = "build" + ToolPath = nugetPath + AccessKey = getBuildParamOrDefault "nugetkey" "" + Publish = hasBuildParam "nugetkey" }) + "nuget/RProvider.nuspec" +) + +// -------------------------------------------------------------------------------------- +// Generate the documentation + +Target "JustGenerateDocs" (fun _ -> + executeFSI "tools" "build.fsx" [] |> ignore +) + +Target "GenerateDocs" DoNothing +"CleanDocs" ==> "JustGenerateDocs" ==> "GenerateDocs" + +// -------------------------------------------------------------------------------------- +// Release Scripts + +let gitHome = "https://github.com/tpetricek" // TODO: Use "BlueMountainCapital" + +Target "ReleaseDocs" (fun _ -> + Repository.clone "" (gitHome + "/FSharp.RProvider.git") "gh-pages" // TODO: Use "FSharpRProvider" + Branches.checkoutBranch "gh-pages" "gh-pages" + CopyRecursive "generated" "gh-pages" true |> printfn "%A" + CommandHelper.runSimpleGitCommand "gh-pages" "add ." |> printfn "%s" + let cmd = sprintf """commit -a -m "Update generated documentation for version %s""" versionNuGet + CommandHelper.runSimpleGitCommand "gh-pages" cmd |> printfn "%s" + Branches.push "gh-pages" +) + +Target "ReleaseBinaries" (fun _ -> + Repository.clone "" (gitHome + "/FSharp.RProvider.git") "release" // dtto. + Branches.checkoutBranch "release" "release" + CopyRecursive "build" "release" true |> printfn "%A" + let cmd = sprintf """commit -a -m "Update binaries for version %s""" versionNuGet + CommandHelper.runSimpleGitCommand "release" cmd |> printfn "%s" + Branches.push "release" +) + +Target "Release" DoNothing + +// -------------------------------------------------------------------------------------- +// Run all targets by default. Invoke 'build ' to override + +Target "All" DoNothing + +"Clean" + ==> "RestorePackages" + ==> "AssemblyInfo" + ==> "Build" + ==> "GenerateDocs" + ==> "RunTests" + ==> "All" + +"All" + ==> "ReleaseDocs" + ==> "ReleaseBinaries" + ==> "NuGet" + ==> "Release" + +RunTargetOrDefault "All" \ No newline at end of file diff --git a/docs/Charts-QuickStart.fsx b/docs/Charts-QuickStart.fsx new file mode 100644 index 00000000..b1d4e614 --- /dev/null +++ b/docs/Charts-QuickStart.fsx @@ -0,0 +1,154 @@ +(*** hide ***) +// Include the right directories so that the documentation tool tips work +#I "../packages/FSharp.Data.1.1.10/lib/net40/" +#I "../build/" + +(** +# Quickstart: Creating Charts + +One of the compelling features of R is its ability to create beautiful charts. +With the R Type Provider, you can use all of R capabilities from F#, +and create simple charts quickly to explore and visualize your data on-the-fly, +as well as generate publication quality graphics that can be exported to virtually any format. + +## Charts Basics + +Basic charts can be found in the graphics package. +Assuming you installed the R Type Provider in your project from NuGet, +you can reference the required libraries and packages this way: +*) + +#I "../packages/RProvider.1.0.3/lib" +#r "RDotNet.dll" +#r "RDotNet.FSharp.dll" +#r "RDotNet.NativeLibrary.dll" +#r "RProvider.dll" + +open System +open RDotNet +open RProvider +open RProvider.``base`` +open RProvider.graphics + +(** +Once the libraries and packages have been loaded, +producing basic charts is as simple as this: +*) + +let widgets = [ 3; 8; 12; 15; 19; 18; 18; 20; ] +let sprockets = [ 5; 4; 6; 7; 12; 9; 5; 6; ] + +R.plot(widgets) + +R.plot(widgets, sprockets) + +R.barplot(widgets) + +R.hist(sprockets) + +R.pie(widgets) + +(** +## Exporting and Saving Charts + +Charts can be exported and saved to various formats; +once you have opened the grDevices package, you can save a chart like this: +*) + +// Required package to save charts +open RProvider.grDevices + +// Create path to an image testimage.png on the Desktop +let desktop = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) +let path = desktop + @"\testimage.png" + +// Open the device and create the file as a png. +// R.bmp, R.jpeg, R.pdf, ... will generate other formats. +R.png(filename=path, height=200, width=300, bg="white") +// Create the chart into the file +R.barplot(widgets) +// Close the device once the chart is complete +R.dev_off () + + +(** +## Advanced Charts Options + +The graphic functions exposed by the R Type Provider come in two flavors; +they either have optional named arguments, +followed by a ParamArray for extended arguments, +or they take named parameters, an IDictionary +which contains all the arguments passed to the function. + +### Named Arguments + +Consider for instance the following example: +*) + +R.barplot(widgets) +R.title(main="Widgets", xlab="Period", ylab="Quantity") + +(** +R.title has 2 signatures, one of them with optional arguments, +demonstrated above to set the main title as well as the labels for the x and y axis, +ignoring some of the other available options. +You can see another example in the previous section in the R.png call. + +### Named Parameters + +Named parameters allow you to specify every argument supported by R, +as an IDictionary of string, object. +The string is the name of the argument, and the object its value. + +Finding the available arguments for a R function can be tricky; +the full list of arguments can usually be found in the +[R developer documentation](http://stat.ethz.ch/R-manual/R-devel/library/), +navigating in the correct package. For instance, R.plot belongs to +graphics, and can be found +[here](http://stat.ethz.ch/R-manual/R-devel/library/graphics/html/plot.html). + +The easiest way to use that feature is to +leverage the built-in function namedParams, like in this example: +*) + +R.plot( + namedParams [ + "x", box widgets; + "type", box "o"; + "col", box "blue"; + "ylim", box [0; 25] ]) + +R.lines( + namedParams [ + "x", box sprockets; + "type", box "o"; + "pch", box 22; + "lty", box 2; + "col", box "red" ]) + +(** +The first call specifies what to plot (widgets), +what type of line to use, the color, and the scale of the axis. +The second call adds sprockets, specifying lty (the line type), +and pch (the plotting character). + +box is used to reduce all elements to objects, +so that the lists have consistent types. + +A possibly more elegant way to use namedParams is to follow the pattern below: +*) + +namedParams [ + "x", box widgets; + "type", box "o"; + "col", box "blue"; + "ylim", box [0; 25] ] +|> R.plot + +namedParams [ + "x", box sprockets; + "type", box "o"; + "pch", box 22; + "lty", box 2; + "col", box "red" ] +|> R.lines \ No newline at end of file diff --git a/docs/Statistics-QuickStart.fsx b/docs/Statistics-QuickStart.fsx new file mode 100644 index 00000000..1c71886d --- /dev/null +++ b/docs/Statistics-QuickStart.fsx @@ -0,0 +1,129 @@ +(*** hide ***) +// Include the right directories so that the documentation tool tips work +#I "../packages/FSharp.Data.1.1.10/lib/net40/" +#I "../build/" + +(** +# Quickstart: Using Statistical Packages + +R is a programming language designed for statistics and data mining. +The R community is strong, and created an incredibly rich open source +ecosystem of packages. + +The F# R Type Provider enables you to use every single one of them, +from within the F# environment. You can manipulate data using F#, +send it to R for computation, and extract back the results. + +## Example: Linear Regression + +Let's perform a simple linear regression from the F# interactive, +using the R.lm function. + +Assuming you installed the R Type Provider in your project from NuGet, +you can reference the required libraries and packages this way: +*) + +#I "../packages/RProvider.1.0.3/lib" +#r "RDotNet.dll" +#r "RDotNet.FSharp.dll" +#r "RDotNet.NativeLibrary.dll" +#r "RProvider.dll" + +open System +open RDotNet +open RProvider +open RProvider.``base`` +open RProvider.graphics +open RProvider.stats + +(** +Once the libraries and packages have been loaded, +Imagine that our true model is + +Y = 5.0 + 3.0 * X1 - 2.0 * X2 + noise + +Let's generate a fake dataset that follows this model: +*) + +// Random number generator +let rng = Random() +let rand () = rng.NextDouble() + +// Generate fake X1 and X2 +let X1s = [ for i in 0 .. 9 -> 10. * rand () ] +let X2s = [ for i in 0 .. 9 -> 5. * rand () ] + +// Build Ys, following the "true" model +let Ys = [ for i in 0 .. 9 -> 5. + 3. * X1s.[i] - 2. * X2s.[i] + rand () ] + +(** +Using linear regression on this dataset, we should be able to +estimate the coefficients 5.0, 3.0 and -2.0, with some imprecision +due to the "noise" part. + +Let's first put our dataset into a R dataframe; this allows us +to name our vectors, and use these names in R formulas afterwards: +*) + +let dataset = + namedParams [ + "Y", box Ys; + "X1", box X1s; + "X2", box X2s; ] + |> R.data_frame + +(** +We can now use R to perform a linear regression. +We call the [R.lm function](http://stat.ethz.ch/R-manual/R-patched/library/stats/html/lm.html), +passing it the formula we want to estimate. +(See the [R manual on formulas](http://stat.ethz.ch/R-manual/R-patched/library/stats/html/formula.html) +for more on their somewhat esoteric construction) +*) + +let result = R.lm(formula = "Y~X1+X2", data = dataset) + +(** +## Extracting Results from R to F# + +The result we get back from R is a R Expression. +The R Type Provider tries as much as possible to keep data +as R Expressions, rather than converting back-and-forth +between F# and R types. It limits translations +between the 2 languages, which has performance benefits, +and simplifies composing R operations. On the other hand, +we need to extract the results from the R expression +into F# types. + +The [R docs for lm](http://stat.ethz.ch/R-manual/R-patched/library/stats/html/lm.html) +describes what R.lm returns: a R List. We can now retrieve each element, +accessing it by name (as defined in the documentation). +For instance, let's retrieve the coefficients and residuals, +which are both R vectors containg floats: +*) + +let coefficients = result.AsList().["coefficients"].AsNumeric() +let residuals = result.AsList().["residuals"].AsNumeric() + +(** +We can also produce summary statistics about our model, +like R^2, which measures goodness-of-fit - close to 0 +indicates a very poor fit, and close to 1 a good fit. +See [R docs for the details on Summary](http://stat.ethz.ch/R-manual/R-patched/library/stats/html/summary.lm.html). +*) + +let summary = R.summary(result) +summary.AsList().["r.squared"].AsNumeric() + +(** +Finally, we can directly pass results, which is a R expression, +to R.plot, to produce some fancy charts describing our model: +*) + +R.plot result + +(** +That's it - while simple, we hope this example illustrate +how you would go about to use any existing R statistical package. +While the details would differ, the general approach would +remain the same. Happy modelling! +*) \ No newline at end of file diff --git a/docs/howto.md b/docs/howto.md new file mode 100644 index 00000000..baf0f760 --- /dev/null +++ b/docs/howto.md @@ -0,0 +1,22 @@ +# How to + +## Packages + +### How do I Load a Package? + +RProvider discovers the packages installed in your R installation and makes them available as packages under the RProvider root namespace. The actual package is lazily loaded the first time you access it. + +### How do I install a new Package? + +Currently you need to load up a real R session, then install the package via install.packages, or the Packages/Install Packages... menu. You will then need to restart Visual Studio because the set of installed packages is cached inside the RProvider. + +#### I have a package installed and it is not showing up +The most likely cause is that RProvider is using a different R installation from the one you updated. When you install R, you get the option to update the registry key `HKEY_LOCAL_MACHINE\SOFTWARE\R-core` to point to the version you are installing. This is what RProvider uses. If you are running in a 32-bit process, RProvider uses `HKEY_LOCAL_MACHINE\SOFTWARE\R-core\R\InstallPath` to determine the path. For 64-bit, it reads `HKEY_LOCAL_MACHINE\SOFTWARE\R-core\R64\InstallPath`. When you install a package in a given version of R, it should be available in both the 32-bit and 64-bit versions. + +## Function and Package names +There are a couple of mismatches between allowed identifiers between R and F#: +### Dots in names +It is pretty common in R to use a dot character in a name, because the character has no special meaning. We remap dots to underscore, and underscore to a double-underscore. So for example, data.frame() becomes R.data_frame(). + +### Names that are reserved F# keywords +Some package and function names are reserved words in F#. For these, you will need to quote them using double-backquotes. Typically, the IDE will do this for you. A good example is the base package, which will require an open statement where "base" is double-back-quoted. diff --git a/docs/img/acf.png b/docs/img/acf.png new file mode 100644 index 00000000..3cfb7c5b Binary files /dev/null and b/docs/img/acf.png differ diff --git a/docs/img/pairs.png b/docs/img/pairs.png new file mode 100644 index 00000000..15b6c477 Binary files /dev/null and b/docs/img/pairs.png differ diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 00000000..e6c2f925 --- /dev/null +++ b/docs/index.md @@ -0,0 +1,87 @@ +F# R Type Provider +======= + + + +The F# Type Provider is a mechanism that enables smooth interoperability +between F# and [R](http://www.r-project.org/). +The Type Provider discovers R packages that are available +in your R installation and makes them available as .NET namespaces +underneath the parent namespace `RProvider`. + +The Type Provider makes it possible to use +all of R capabilities, from the F# interactive environment. +It enables on-the-fly charting and data analysis using R packages, +with the added benefit of IntelliSense over R, +and compile-time type-checking that the R functions you are using exist. +It allows you to leverage all of .NET libraries, +as well as F# unique capabilities to access and manipulate data +from a wide variety of sources via Type Providers. + +### A Quick Demo + +
+ +
+ +## What are R and F#? + +[F#](http://msdn.microsoft.com/en-us/vstudio/hh388569) is a mixed-paradigm language +that supports functional, object-oriented and imperative programming, +with the emphasis on functional. F# runs on the .NET runtime and is a compiled, +statically typed language with a strong type system and type inference. +F# is a general purpose programming language, +and is particularly well-suited for scientific/numerical computing. + +[R](http://www.r-project.org/) is an Open Source language for statistical computing. +R offers a wide range of high-quality, community-developed packages, +covering virtually every area of statistics, econometrics or machine learning. +It is also famous for its charting capabilities, making it a great tool +to produce publication-quality graphics. +R is an interpreted, dynamically typed language that is typically used +from its GUI, [RStudio](http://www.rstudio.com/), or command line interactive environment. + +## Using the R Type Provider + +
+
+
+
+ Install using the NuGet package. + Run the following command in the Package Manager Console: +
PM> Install-Package RProvider
+
+
+
+
+ +### Pre-requisites + +The R Provider requires an installation of R for Windows, downloadable from +[here](http://cran.cnr.berkeley.edu/bin/windows/base/). RProvider uses the R registry key +`SOFTWARE\R-core` to locate the R binary directory, in order to load `R.dll`. It will also +locate `R.dll` if it is on the path. If run from a 32-bit process, RProvider will use +the 32-bit `R.dll`, and if run from a 64-bit process, it will load the 64-bit version. + +If you are using R 2.15 or later, you should not try to load the RProvider inside a script +that is passed to FSI via the `--use` flag. It seems that something about the way R +initializes causes it to hang in that context. Works fine if you load later. + +For compilation you will need VS2012 / F# 3.0 or later. For runtime you'll need .NET 4.5. + +Contributing and copyright +-------------------------- + +The project has been developed by [BlueMountain Capital](https://www.bluemountaincapital.com/) +and contributors. It is available under the BSD license. The library uses +[RDotNet](http://rdotnet.codeplex.com/) which is also covered by the BSD license. +For more information see the [License file][license] in the GitHub repository. + +The project is hosted on [GitHub][gh] where you can [report issues][issues], fork +the project and submit pull requests. +Many thanks to Mathias Brandewinder for producing the [FAKE](https://github.com/fsharp/FAKE) script +to build the NuGet package, and to Steffen Forkman for writing [FAKE](https://github.com/fsharp/FAKE). + +[gh]: https://github.com/blueMountainCapital/FSharpRProvider +[issues]: https://github.com/blueMountainCapital/FSharpRProvider/issues +[license]: https://github.com/blueMountainCapital/FSharpRProvider/blob/master/LICENSE.md diff --git a/docs/internals.md b/docs/internals.md new file mode 100644 index 00000000..cf24126f --- /dev/null +++ b/docs/internals.md @@ -0,0 +1,22 @@ +# How does it work? + +## How do we call into R? +The RProvider loads the R.DLL (which contains the core of R) into the calling process, via [RDotNet](http://rdotnet.codeplex.com/). This will happen in several places: + +* In the IDE, to provide IntelliSense for packages/functions/parameters. +* In the F# compiler, to generate code that calls the R functionality you are calling. +* In your resulting binary, to execute the generated code. +* In F# Interactive, to do all of the above interactively. + +## How does RDotNet help? +RDotNet allows R functionality to be called from .NET, and exposes an object model for representing R values (based on the type RDotNet.SymbolExpression). Using RDotNet, one executes R code by passing strings of R code into an Evaluate method. From the RProvider, we introspect on available R packages and functions and expose them as members of provided types. You can then call them just like regular .NET functions, with IntelliSense and compile-time checking. RDotNet.SymbolicExpression provides a nice OO model of the R native SEXP type, so we simply expose results using that type. To make it more friendly from F#, we extend it with some extension members and active patterns. + +## How do we expose R packages? +RProvider determines the set of installed packages in your R installation and exposes them as namespaces under the root RProvider namespace. This allows you to 'open' the namespaces you want to use as if they were regular .NET namespaces. + +Under the namespace for a given package, RProvider exposes a single static type called "R", which contains static methods mirroring each of the functions and values that exist in the package. This means that the members under "R." will be the union of available functions in all of the package namespaces you have opened. + +## Is it Statically Typed? +Kind of. It is statically type checked to the extent that it can be given the type information available from R. In practice, this means that the F# compiler and IDE statically checks that the function you are calling exists in the package you are calling. In some cases, we can also determine that you are not passing too many arguments to the function, though common use of ... (aka varargs/params) in R functions defeats that in many cases. + +R is dynamically typed, so we cannot determine what the types of function arguments are supposed to be. So all arguments are of type obj. R functions can also be written such that they will work even if arguments that do not have default values are omitted, so we expose each argument as optional. And for R functions that accept a ... argument, we expose a paramarray argument that allows any number of additional arguments to be passed. In that case, you can basically pass any number of arguments to the function. \ No newline at end of file diff --git a/Documentation/misc/logo.pdn b/docs/misc/logo.pdn old mode 100755 new mode 100644 similarity index 100% rename from Documentation/misc/logo.pdn rename to docs/misc/logo.pdn diff --git a/Documentation/misc/logo.png b/docs/misc/logo.png old mode 100755 new mode 100644 similarity index 100% rename from Documentation/misc/logo.png rename to docs/misc/logo.png diff --git a/docs/packages.config b/docs/packages.config new file mode 100644 index 00000000..2b3c0ed9 --- /dev/null +++ b/docs/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/docs/passing-data.fsx b/docs/passing-data.fsx new file mode 100644 index 00000000..dfee0556 --- /dev/null +++ b/docs/passing-data.fsx @@ -0,0 +1,114 @@ +(*** hide ***) +#I "../packages/FSharp.Data.1.1.10/lib/net40/" +#I "../build/" +#r "RDotNet.dll" +#r "RDotNet.FSharp.dll" +#r "RProvider.dll" +open System +open RDotNet +open RProvider +open RProvider.``base`` + +(** +# Passing Data Between F# and R + +## Passing Parameters + +### Parameter Passing Conventions + +R supports various kinds of parameters, which we try to map onto equivalent F# parameter types: + + * All R formal parameters have names, and you can always pass their values either by name or positionally. If you pass by name, you can skip arguments in your actual argument list. We simply map these onto F# arguments, which you can also pass by name or positionally. + + * In R, essentially all arguments are optional (even if no default value is specified in the function argument list). It's up to the receiving function to determine whether to error if the value is missing. So we make all arguments optional. + + * R functions support ... (varargs/paramarray). We map this onto a .NET ParamArray, which allows an arbitrary number of arguments to be passed. However, there are a couple of kinks with this: + + * R allows named arguments to appear _after_ the ... argument, whereas .NET requires the ParamArray argument to be at the end. Some R functions use this convention because their primary arguments are passed in the ... argument and the named arguments will sometimes be used to modify the behavior of the function. From the RProvider you will to supply values for the positional arguments before you can pass to the ... argument. If you don't want to supply a value to one of these arguments, you can explicitly pass System.Reflection.Missing. + + * Parameters passed to the R ... argument can also be passed using a name. Those names are accessible to the calling function. Example are list and dataframe construction (R.list, and R.data_frame). To pass arguments this way, you can use the overload of each function that takes an IDictionary, either directly, or using the namedParams function. For example: + + R.data_frame(namedParams [ "A", [|1;2;3|]; "B", [|4;5;6|] ]) + +### Parameter Types + +Since all arguments to functions are of type obj, it is not necessarily obvious what you can pass. Ultimately, you will need to know what the underlying function is expecting, but here is a table to help you. When reading this, remember that for most types, R supports only vector types. There are no scalar string, int, bool etc. types. + + + + + + + + + + +
R TypeF#/.NET Type
characterstring or string[]
complexSystem.Numerics.Complex or Complex[]
integerint or int[]
logicalbool or bool[]
numericdouble or double[]
listCall R.list, passing the values as separate arguments
dataframeCall R.data_frame, passing column vectors in a dictionary
+ +**NB**: For any input, you can also pass a SymbolicExpression instance you received as the result of calling another R function. Doing so it a very efficient way of passing data from one function to the next, since there is no marshalling between .NET and R types in that case. + +## Accessing results + +Functions exposed by the RProvider return an instance of `RDotNet.SymbolicExpression`. This keeps all return data inside R data structures, so does not impose any data marshalling overhead. If you want to pass the value in as an argument to another R function, you can simply do so. + +In order to access the result in .NET code, you have three routes: + +### Convert the data into a specified .NET type via GetValue() + +RProvider adds a generic `GetValue<'T>` extension method to `SymbolicExpression`. This supports conversions from certain R values to specific .NET types. Here are the currently supported conversions: + + + + + + + + + + + + + +
R TypeRequested F#/.NET Type
character (when vector is length 1)string
characterstring[]
complex (when vector is length 1)Complex
complexComplex[]
integer (when vector is length 1)int
integerint[]
logical (when vector is length 1)bool
logicalbool[]
numeric (when vector is length 1)double
numericdouble[]
+ +Custom conversions can be supported through [plugins](plugins.html). + +### Convert the data into the default .NET type the .Value property + +We also expose an extension property called Value that performs a _default_ conversion of a SymbolicExpresion to a .NET type. These are the current conversions: + + + + + + + + +
R TypeF#/.NET Type
characterstring[]
complexComplex[]
integerint[]
logicalbool[]
numericdouble[]
+ +Again, custom conversions can be supported through [plugins](plugins.html). + +### Explicitly access the data in the SymbolicExpression + +If there are no supported conversions, you can access the data through the RDotNet object model. RDotNet exposes properties, members and extension members (available only if you open the RDotNet namespace) that allow you to access the underlying data directly. So, for example: +*) + +let res = R.sum([|1;2;3;4|]) +if res.Type = RDotNet.Internals.SymbolicExpressionType.IntegerVector then res.AsInteger().[0] +else failwithf "Expecting a Numeric but got a %A" res.Type + +(** +To make this easier, we have defined some active patterns, under the RProvider.Helpers namespace, which is auto-opened when you open the RProvider namespace. These combine the type tests and conversion. An equivalent example: +*) + +match R.sum([|1;2;3;4|]) with +| IntegerVector(iv) -> iv.[0] +| _ -> failwithf "Expecting a Numeric but got a %A" res.Type + +(** +## What if I commonly need an argument or result conversion that RProvider does not support? + +If you believe the argument conversion is universally appropriate and should be available to everybody, please fork the repo and submit a pull request. + +RProvider also supports custom conversions to/from your own data types using [plugins](plugins.html). +*) \ No newline at end of file diff --git a/docs/plugins.md b/docs/plugins.md new file mode 100644 index 00000000..89a019af --- /dev/null +++ b/docs/plugins.md @@ -0,0 +1,11 @@ +# Plugins + +RProvider supports plugins to support custom functionality. It uses [MEF](http://msdn.microsoft.com/en-us/library/dd460648.aspx) to load plugins that export certain contracts. See below for examples. + +Before implementing a plugin you should consider whether your conversion is universally applicable and should be added to the core conversion logic in the provider. If so, please log as an issue, and ideally fork the repo and submit a pull request. + +## Supporting an implicit parameter conversion for a datatype + +## Supporting an explicit result conversion for a datatype + +## Supporting a default result conversion \ No newline at end of file diff --git a/docs/tutorial.fsx b/docs/tutorial.fsx new file mode 100644 index 00000000..da5ae6b2 --- /dev/null +++ b/docs/tutorial.fsx @@ -0,0 +1,113 @@ +(*** hide ***) +// Include the right directories so that the documentation tool tips work +#I "../packages/FSharp.Data.1.1.10/lib/net40/" +#I "../build/" + +(** +# R Provider Tutorial + +## Referencing the provider + +In order to use the R provider, you need to reference the `RDotNet.dll` library +(which is a .NET connector for R) and the `RProvider.dll` itself. For this tutorial, +we use `open` to reference a number of packages including `stats`, `tseries` and `zoo`: +*) +#I "../packages/RProvider.1.0.3/lib" +#r "RDotNet.dll" +#r "RDotNet.FSharp.dll" +#r "RDotNet.NativeLibrary.dll" +#r "RProvider.dll" + +open RDotNet +open RProvider +open RProvider.``base`` +open RProvider.graphics +open RProvider.stats +open RProvider.tseries +open RProvider.zoo + +open System +open System.Net + +(** +If either of the namespaces above are unrecognized, you need to install the package in R +using `install.packages("stats")`. + +## Obtaining data + +In this tutorial, we use [F# Data](http://fsharp.github.io/FSharp.Data/) to access stock +prices from the Yahoo Finance portal. For more information, see the documentation for the +[CSV type provider](http://fsharp.github.io/FSharp.Data/library/CsvProvider.html). + +The following snippet uses the CSV type provider to generate a type `Stocks` that can be +used for parsing CSV data from Yahoo. Then it defines a function `getStockPrices` that returns +array with prices for the specified stock and a specified number of days: +*) +#r "FSharp.Data.dll" +open FSharp.Data + +type Stocks = CsvProvider<"http://ichart.finance.yahoo.com/table.csv?s=SPX"> + +/// Returns prices of a given stock for a specified number +/// of days (starting from the most recent) +let getStockPrices stock count = + let url = "http://ichart.finance.yahoo.com/table.csv?s=" + [| for r in Stocks.Load(url + stock).Take(count).Data -> float r.Open |] + |> Array.rev + +/// Get opening prices for MSFT for the last 255 days +let msftOpens = getStockPrices "MSFT" 255 + +(** +## Calling R functions + +Now, we're ready to call R functions using the type provider. The following snippet takes +`msftOpens`, calculates logarithm of the values using `R.log` and then calculates the +differences of the resulting vector using `R.diff`: +*) + +// Retrieve stock price time series and compute returns +let msft = msftOpens |> R.log |> R.diff + + +(** +If you want to see the resulting values, you can call `msft.AsVector()` in F# Interactive. +Next, we use the `acf` function to display the atuo-correlation and call `adf_test` to +see if the `msft` returns are stationary/non-unit root: +*) + +let a = R.acf(msft) +let adf = R.adf_test(msft) + +(** +After running the first snippet, a window similar to the following should appear (note that +it might not appear as a top-most window). + +
+ +
+ +Finally, we can obtain data for multiple different indicators and use the `R.pairs` function +to produce a matrix of scatter plots: +*) + +// Build a list of tickers and get diff of logs of prices for each one +let tickers = + [ "MSFT"; "AAPL"; "X"; "VXX"; "SPX"; "GLD" ] +let data = + [ for t in tickers -> + printfn "got one!" + t, getStockPrices t 255 |> R.log |> R.diff ] + +// Create an R data frame with the data and call 'R.pairs' +let df = R.data_frame(namedParams data) +R.pairs(df) + +(** +As a result, you should see a window showing results similar to these: + +
+ +
+ +*) diff --git a/docs/whatwhy.md b/docs/whatwhy.md new file mode 100644 index 00000000..a067eeae --- /dev/null +++ b/docs/whatwhy.md @@ -0,0 +1,27 @@ +# Whats and Whys + +## What is R? + +[R](http://www.r-project.org/) is an Open Source package for statistical computing. There are a wide range of community-developed packages available that are very useful in the statistical computing/econometrics space. + +R is an interpreted, dynamically typed language that is typically used from its GUI or command line interactive environment. But R is also embeddable using the R.DLL. + +## What is F#? + +[F#](http://msdn.microsoft.com/en-us/vstudio/hh388569) is a mixed-paradigm language that supports functional, object-oriented and imperative programming, with the emphasis on functional. F# runs on the .NET runtime and is a compiled, statically typed language with a strong type system and type inference. F# is typically used in the scientific/numerical computing space, though is quite widely applicable. + +## Why use R with F#? + +While there are a number of math/statistical packages available for the .NET platform, none of the approach the power of the packages that are available for R. R also includes versatile packages for visualization which are hard to match on .NET. + +## What is a Type Provider? + +F# 3.0 supports a new feature called [Type Providers](http://msdn.microsoft.com/en-us/library/hh156509.aspx) which allow a set of types and members to be determined at compile time (or in the IDE) based on statically known parameters and (optionally) access to some external resource. The primary purpose of Type Providers is to support strongly-typed access to external data sources, without the additional step of code generation, which adds friction to the development process and is sometimes impractical due to the size of the type space. Type Providers can also be used to interoperate with another language or runtime environment, by introspecting on constructs available in that environment during compile time and making equivalent constructs available to F#. + +## Why not just use R directly? + +In some cases, this will make a lot of sense, but there are a number of reasons why it might not: + +1. F# is particularly well-suited for the retrieval and manipulation/cleansing of data, which we will subsequently want to use in statistical models. +2. We can combine functionality in .NET libraries (or otherwise callable from F#) with R functionality in a low-friction way. +3. F# is well-suited to building scalable production applications, and using the R type provider allows us to use R functionality from those applications? diff --git a/RProvider.nuspec b/nuget/RProvider.nuspec similarity index 64% rename from RProvider.nuspec rename to nuget/RProvider.nuspec index a10e07a7..81cda46a 100644 --- a/RProvider.nuspec +++ b/nuget/RProvider.nuspec @@ -1,19 +1,28 @@ - R Type Provider - RProvider - 0.1.2 + @project@ + @build.number@ @authors@ - en-US - @summary@ + @authors@ https://github.com/BlueMountainCapital/FSharpRProvider https://github.com/BlueMountainCapital/FSharpRProvider/blob/master/LICENSE.md - F# R TypeProvider https://raw.github.com/BlueMountainCapital/FSharpRProvider/master/Documentation/misc/logo.png + @summary@ + @description@ + @releaseNotes@ + Copyright 2013 + @tags@ + en-US - \ No newline at end of file + + + + + + + diff --git a/init.ps1 b/nuget/init.ps1 similarity index 100% rename from init.ps1 rename to nuget/init.ps1 diff --git a/nuget/publish.cmd b/nuget/publish.cmd new file mode 100644 index 00000000..02cd0b1d --- /dev/null +++ b/nuget/publish.cmd @@ -0,0 +1 @@ +@for %%f in (..\bin\*.nupkg) do @..\.nuget\NuGet.exe push %%f \ No newline at end of file diff --git a/src/Common/AssemblyInfo.fs b/src/Common/AssemblyInfo.fs new file mode 100644 index 00000000..0910ef62 --- /dev/null +++ b/src/Common/AssemblyInfo.fs @@ -0,0 +1,11 @@ +module internal AssemblyInfo +open System.Reflection + +[] +[] +[] +[] +[] +[] + +() diff --git a/ProvidedTypes-0.2.fs b/src/Common/ProvidedTypes-0.2.fs similarity index 100% rename from ProvidedTypes-0.2.fs rename to src/Common/ProvidedTypes-0.2.fs diff --git a/ProvidedTypes-0.2.fsi b/src/Common/ProvidedTypes-0.2.fsi similarity index 100% rename from ProvidedTypes-0.2.fsi rename to src/Common/ProvidedTypes-0.2.fsi diff --git a/CharacterDeviceInterceptor.fs b/src/RProvider/CharacterDeviceInterceptor.fs similarity index 100% rename from CharacterDeviceInterceptor.fs rename to src/RProvider/CharacterDeviceInterceptor.fs diff --git a/converters.fs b/src/RProvider/Converters.fs similarity index 100% rename from converters.fs rename to src/RProvider/Converters.fs diff --git a/example.fsx b/src/RProvider/Example.fsx similarity index 95% rename from example.fsx rename to src/RProvider/Example.fsx index 267cb1a4..8abeffa4 100644 --- a/example.fsx +++ b/src/RProvider/Example.fsx @@ -1,5 +1,5 @@ -#r @"bin/Debug/RDotNet.dll" -#r @"bin/Debug/RProvider.dll" +#r @"../../build/RDotNet.dll" +#r @"../../build/RProvider.dll" open RDotNet open RProvider diff --git a/RInterop.fs b/src/RProvider/RInterop.fs similarity index 100% rename from RInterop.fs rename to src/RProvider/RInterop.fs diff --git a/RProvider.fs b/src/RProvider/RProvider.fs similarity index 100% rename from RProvider.fs rename to src/RProvider/RProvider.fs diff --git a/RProvider.fsproj b/src/RProvider/RProvider.fsproj similarity index 83% rename from RProvider.fsproj rename to src/RProvider/RProvider.fsproj index b187a26f..c9b7aae4 100644 --- a/RProvider.fsproj +++ b/src/RProvider/RProvider.fsproj @@ -14,7 +14,7 @@ RProvider Always - .\ + ..\..\ true @@ -22,7 +22,7 @@ full false false - bin\Debug\ + ../../build DEBUG;TRACE 3 Program @@ -36,41 +36,46 @@ pdbonly true true - bin\Release\ + ../../build TRACE 3 - - - + + AssemblyInfo.fs + + + ProvidedTypes-0.2.fsi + + + ProvidedTypes-0.2.fs + - - packages\R.NET.1.5.5\lib\net40\RDotNet.dll + ..\..\packages\R.NET.1.5.5\lib\net40\RDotNet.dll True - packages\RDotNet.FSharp.0.1.2.1\lib\net40\RDotNet.FSharp.dll + ..\..\packages\RDotNet.FSharp.0.1.2.1\lib\net40\RDotNet.FSharp.dll True - packages\R.NET.1.5.5\lib\net40\RDotNet.NativeLibrary.dll + ..\..\packages\R.NET.1.5.5\lib\net40\RDotNet.NativeLibrary.dll True diff --git a/RWrapperGenerator/packages.config b/src/RProvider/packages.config similarity index 100% rename from RWrapperGenerator/packages.config rename to src/RProvider/packages.config diff --git a/RWrapperGenerator/App.config b/src/RWrapperGenerator/App.config similarity index 100% rename from RWrapperGenerator/App.config rename to src/RWrapperGenerator/App.config diff --git a/RWrapperGenerator/Program.fs b/src/RWrapperGenerator/Program.fs similarity index 100% rename from RWrapperGenerator/Program.fs rename to src/RWrapperGenerator/Program.fs diff --git a/RWrapperGenerator/RWrapperGenerator.fsproj b/src/RWrapperGenerator/RWrapperGenerator.fsproj similarity index 84% rename from RWrapperGenerator/RWrapperGenerator.fsproj rename to src/RWrapperGenerator/RWrapperGenerator.fsproj index 48dd7141..58addebc 100644 --- a/RWrapperGenerator/RWrapperGenerator.fsproj +++ b/src/RWrapperGenerator/RWrapperGenerator.fsproj @@ -23,7 +23,7 @@ DEBUG;TRACE 3 AnyCPU - bin\Debug\RWrapperGenerator.XML + bin\Debug\RWrapperGenerator.xml true /outFile=c:\temp\out.cs /packges=base,stats,graphics,grDevices,tseries,zoo @@ -35,7 +35,7 @@ TRACE 3 AnyCPU - bin\Release\RWrapperGenerator.XML + bin\Release\RWrapperGenerator.xml true @@ -44,15 +44,15 @@ True - ..\packages\R.NET.1.5.5\lib\net40\RDotNet.dll + ..\..\packages\R.NET.1.5.5\lib\net40\RDotNet.dll True - ..\packages\RDotNet.FSharp.0.1.2.1\lib\net40\RDotNet.FSharp.dll + ..\..\packages\RDotNet.FSharp.0.1.2.1\lib\net40\RDotNet.FSharp.dll True - ..\packages\R.NET.1.5.5\lib\net40\RDotNet.NativeLibrary.dll + ..\..\packages\R.NET.1.5.5\lib\net40\RDotNet.NativeLibrary.dll True @@ -62,16 +62,19 @@ - + + AssemblyInfo.fs + + ProvidedTypes-0.2.fsi - + ProvidedTypes-0.2.fs - + CharacterDeviceInterceptor.fs - + RInterop.fs diff --git a/packages.config b/src/RWrapperGenerator/packages.config similarity index 100% rename from packages.config rename to src/RWrapperGenerator/packages.config diff --git a/Test.RProvider/Test.RProvider.fsproj b/tests/Test.RProvider/Test.RProvider.fsproj similarity index 80% rename from Test.RProvider/Test.RProvider.fsproj rename to tests/Test.RProvider/Test.RProvider.fsproj index 9c82c212..d549efb4 100644 --- a/Test.RProvider/Test.RProvider.fsproj +++ b/tests/Test.RProvider/Test.RProvider.fsproj @@ -11,6 +11,8 @@ Test.RProvider v4.5 Test.RProvider + ..\..\ + true true @@ -35,37 +37,41 @@ 11 + + - References\FsCheck.dll + ..\..\packages\FsCheck.0.9.1.0\lib\net40-Client\FsCheck.dll + True - References\FsCheck.Xunit.dll + ..\..\packages\FsCheck.Xunit.0.4.0.1\lib\net40-Client\FsCheck.Xunit.dll + True True - ..\bin\Debug\RDotNet.dll + ..\..\packages\R.NET.1.5.5\lib\net40\RDotNet.dll True - ..\bin\Debug\RDotNet.NativeLibrary.dll + ..\..\packages\R.NET.1.5.5\lib\net40\RDotNet.NativeLibrary.dll True - ..\bin\Debug\RProvider.dll - True + ..\..\build\RProvider.dll - References\xunit.dll + ..\..\packages\xunit.1.9.2\lib\net20\xunit.dll + True