f#-data

scripts don't recognize FSharp.Data

天大地大妈咪最大 提交于 2019-12-19 13:38:13
问题 Somewhat of a F# beginner. I'm trying to test out some of my XmlTypeProvider code in the interactive window by first entering it in a script (fsx) file. The script file won't recognize the following open FSharp.Data // gives "The namespace or module 'FSharp' is not defined" Everything has been added to reference, and .fs files seem to not have any problems finding the XmlTypeProvider reference but for some reason, a script in the same project does not. I even got the code to work in a .fs

Reading value from XML file Throws an error - FAKE F#MAKE

左心房为你撑大大i 提交于 2019-12-13 17:21:01
问题 I am trying to read value from XML file from FAKE , But I am getting an error i.e. .fsx(9,16) : eror FS000: Incomplete structurd construct at or before this point in expression. Expected '->' or other token. Below is my code , I am using XMLHelper.XMLRead to read values from xml file . #r "./packages/FAKE/tools/FakeLib.dll" open Fake open Fake.XMLHelper Target "BuildMain" (fun _ -> for s in XMLHelper.XMLRead true "D:/test/Version.Config" "/version/major/minor" trace s) "BuildMain"

The type 'XmlProvider' is not defined

≯℡__Kan透↙ 提交于 2019-12-13 14:07:21
问题 I'm trying to use the FSharp.Data third party library but am getting an error The type 'XmlProvider' is not defined on the XmlProvider class. namespace KMyMoney open FSharp.Data module Read = let xml = File.ReadAllText("KMyMoneySampleFile.xml") type KMyMoneySource = XmlProvider<xml> I'm using NuGet to get the library. Library is 'FSharp.Data 1.1.8' When I type FSharp.Data. There are four options given: Csv , FreebaseOperators , Json , and RuntimeImplementation . Am I missing something? I'm

The type 'XmlProvider<…>.Parameter' does not support the operator 'get_Value'?

旧城冷巷雨未停 提交于 2019-12-12 01:49:26
问题 How to fix the code? Is the inline/Statically Resolved Type the same powerful as structural typing? The type 'XmlProvider<...>.Parameter' does not support the operator 'get_Value'? let input1 = """<r1><parameters><parameter name="token">1</parameter><parameter name="other">xxx</parameter></parameters><othersOf1>..sample....</othersOf1></r1>""" let xml1 = XmlProvider<"""<r1><parameters><parameter name="token">1</parameter><parameter name="other">xxx</parameter></parameters><othersOf1>...<

F# CsvTypeProvider extracting the same columns from slightly different csv-files

天涯浪子 提交于 2019-12-11 05:05:05
问题 I am creating a program that reads football matches from different CSV files. The columns I am interested in are present in all the files, but the files have a varying number of columns. This left me creating a separate mapping function for each variation of file, with a different sample for each type: type GamesFile14 = CsvProvider<"./data/sample_14.csv"> type GamesFile15 = CsvProvider<"./data/sample_15.csv"> type GamesFile1617 = CsvProvider<"./data/sample_1617.csv"> let mapRows14 (rows:seq

F# Type Provider Dependent Nested Types

旧时模样 提交于 2019-12-11 03:19:08
问题 I am trying to build a TypeProvider where nested ProvidedProperty is generated based on parent's type value. A result I want to have is following #r @"bin/Debug/library.dll" open Library.TypeProviders type sdmx = SdmxDataProvider<WsEntryPoint=""> let dataflows = sdmx.GetDataFlowsContext() let a = dataflows.A.A1 // A1,A2,A3 < should be generated based on A let b = dataflows.B.B1 // B1,B2,B3 < should be generated based on B let c = dataflows.C.C1 // C1,C2,C3 < should be generated based on C I

CsvProvider throws OutOfMemoryException

佐手、 提交于 2019-12-11 00:19:12
问题 FAOCropsLivestock.csv contains more than 14 million row. In my .fs file I have declared type FAO = CsvProvider<"c:\FAOCropsLivestock.csv"> and tried to work with follwoing code FAO.GetSample().Rows.Where(fun x -> x.Country = country) |> .... FAO.GetSample().Filter(fun x -> x.Country = country) |> .... In both cases, exception was thrown. I also have tried with follwoing code after loading the csv file in MSSQL Server type Schema = SqlDataConnection<conStr> let db = Schema.GetDataContext() db

F#: Is Profile 47 required for Microsoft.FSharp.Data.TypeProviders?

元气小坏坏 提交于 2019-12-10 18:09:46
问题 This is a follow-up to my post yesterday. To recap, I received this error message when trying to build my project: FSC: Error FS2024: Static linking may not use assembly that targets different profile I consulted some kind people in the F# fpchat.com channel, and one of them suggested that the error could be due to the fact that I did not have Profile 47, because FSharp.Data uses Profile 47. I tried downloading the target pack for Profile 47, but was redirected to the Microsoft homepage

F# JSON parsing - How to get property using complex path (consisting of several propery names)

风流意气都作罢 提交于 2019-12-10 16:38:37
问题 Is it possible to get property from JSON using complex path, like "prop1.prop2" ? Sample of JSON I used: { "prop1": { "prop2": "value" } } What I have want is to get property "prop2" there with its value "value" : When I tried: #r "../packages/FSharp.Data.2.3.0/lib/net40/FSharp.Data.dll" open FSharp.Data open FSharp.Data.JsonExtensions let json = JsonValue.Load "SampleJson.json" json.GetProperty("prop1.prop2") I got: System.Exception: Didn't find property 'prop1.prop2' in {"prop1":{"prop2":

Is FSharp.Data.DesignTime .NET 4.5 only?

≡放荡痞女 提交于 2019-12-10 14:49:03
问题 I'm using FSharp.Data.1.1.10 in a .NET 4.0 project, and when I add FSharp.Data with Nuget, it creates a packages\FSharp.Data.1.1.10\lib\net40 directory where it puts FSharp.Data.dll and FSharp.Data.DesignTime.dll . According to Telerik JustDecompile, FSharp.Data.dll is a .NET 4.0 dll, but FSharp.Data.DesignTime.dll is a .NET 4.5 dll even though it resides in the net40 subdirectory. So, is FSharp.Data.DesignTime .NET 4.5 only, or is this a bug? 回答1: Yes, FSharp.Data.DesignTime is .NET 4.5, but