type-providers

F# Connect SQLProvider with Postgres

青春壹個敷衍的年華 提交于 2019-12-23 12:09:57
问题 I'm a beginner in both F# and the .Net world, I'm trying to make this F# script work: #r "./packages/SQLProvider/lib/netstandard2.0/FSharp.Data.SqlProvider.dll" #r "./packages/SQLProvider/lib/netstandard2.0/netstandard.dll" #r "./packages/Npgsql/lib/netstandard2.0/Npgsql.dll" open FSharp.Data.Sql open Npgsql let [<Literal>] ConnString = "Host=localhost;" + "Port=5431;" + "Database=suavetododb;" + "Username=postgres;" + "Password=postgres" let [<Literal>] DbVendor = Common

Reusing type definitions with JSONProvider?

时光总嘲笑我的痴心妄想 提交于 2019-12-23 10:26:58
问题 I'm using the JSONProvider from FSharp-Data to automatically create types for a webservice that I'm consuming using sample responses from the service. However I'm a bit confused when it comes to types that are reused in the service, like for example there is one api method that return a single item of type X while another returns a list of X and so on. Do I really have to generate multiple definitions for this, and won't that mean that I will have duplicate types for the same thing? So, I

Type annotation for using a F# TypeProvider type e.g. FSharp.Data.JsonProvider<…>.DomainTypes.Url

不羁的心 提交于 2019-12-23 09:30:00
问题 I'm using the FSharp.Data.JsonProvider to read Twitter Tweets. Playing with this sample code https://github.com/tpetricek/Documents/tree/master/Samples/Twitter.API I want to expand the urls in the tweet with let expandUrl (txt:string) (url:Search.DomainTypes<...>.DomainTypes.Url) = txt.Replace( url.Url, url.ExpandedUrl ) This results in Error: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to

Data sample for JSON type provider with optional property

蹲街弑〆低调 提交于 2019-12-23 09:19:48
问题 I am trying to use the JSON type provider to access StackOverflow / StackExchange data via the API. It works great, with one caveat. The API has a throttle, which is signaled by a field "backoff" that contains the number of seconds you are supposed to back off until your next request. As a result, I can't just point the JSON TP to the url, because by default the backoff field is not present. This is how the response typically looks: { "items": [ { "has_synonyms": true, "user_id": 1144035, "is

Generated Types Provider working example [closed]

孤者浪人 提交于 2019-12-21 14:03:43
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 6 years ago . Can somebody point me to working example of generated types F# TypeProvider? Ideally, based on F# sample pack "ProvidedTypes-*.fs"

Are there plans to support “type providers” for Scala's SIQ (ScalaIntegratedQuery) like in F#?

99封情书 提交于 2019-12-21 03:52:44
问题 The current state of SIQ was presented by Christopher Vogt at ScalaDays 2011. It was shown how queries would work and look like, but as far as I remember there was no notion about how those types would be represented, e. g. if it is still necessary to write boilerplate code to explain the database structure to Scala. F# 3.0 adds type providers (PDC talk by Don Syme: video; GOTO Copenhagen talk by Tomas Petricek: video, slides, blog post), which make it basically unnecessary to manually write

How do I create an F# Type Provider that can be used from C#?

≯℡__Kan透↙ 提交于 2019-12-17 15:38:56
问题 If I use the F# Type Providers from the assembly FSharp.Data.TypeProviders 4.3.0.0, I am able to create types in a very simple F# library. I am then able to use those types without any dependency on the assembly FSharp.Data.TypeProviders. That is pretty sweet! Here is an example: I created an F# library project called TryTypeProviders. I put this in the .fs: module TryTypeProviders type Northwind = Microsoft.FSharp.Data.TypeProviders.ODataService I then am able to use the F# library from a C#

F# query concatenation

爱⌒轻易说出口 提交于 2019-12-14 01:36:27
问题 I am using SqlDataConnection data provider in F# to migrate some rows, part of that migration is to make a join between 3 tables like this, think of it as an inheritance of tables A , B , C where B and C inherit from A so the thing is I need to get is (in Linq-like): Bs.Join(As, b.PK, a.FK).Select(new {...}) .Concat(Cs.Join(As, c.PK, a.FK).Select(new {...}) In F# , the closest I got to this was: let result = seq { yield! query { ... } yield! query { ... } } but I've been told this will

F# generating types in a type extension function within a type provider

笑着哭i 提交于 2019-12-13 14:23:28
问题 I have the following problem: Within my type provider, I need to extend a generic type, that I have previously defined, with a method that will return an instance of this generic type. What I mean is, let's say we have : type receiveType<'a> = class val Next:int val Type:string new (state,stateType) = {Next = state;Type = stateType;} end later within my typeprovider I want to extend the type with the following function: [<TypeProvider>] type ProviderTest() as this= ( inherit

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