我正在使用FSharp.Data.JsonProvider
Twitter推文.
使用此示例代码 https://github.com/tpetricek/Documents/tree/master/Samples/Twitter.API
我想扩展推文中的网址
let expandUrl (txt:string) (url:Search.DomainTypes<...>.DomainTypes.Url) =
txt.Replace( url.Url, url.ExpandedUrl )
Run Code Online (Sandbox Code Playgroud)
这会导致错误:
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 constrain the type of the object.
Run Code Online (Sandbox Code Playgroud)
我的问题是如何TypeProvider
在上面的expandUrl函数中定义url 的类型?
类型感染告诉我这个
val urls : FSharp.Data.JsonProvider<...>.DomainTypes.Url []
Run Code Online (Sandbox Code Playgroud)
但是在类型声明中不接受这一点.我假设"<...>"不是F#synatx.
如何使用TypeProvider类型进行类型注释,例如 FSharp.Data.JsonProvider<...>.DomainTypes.Url ?
以下是完整的代码段:
open TwitterAPI // github.com/tpetricek/Documents/tree/master/Samples/Twitter.API
let twitter = TwitterAPI.TwitterContext( _consumerKey, _consumerSecret, _accessToken, _accessTokenSecret )
let query = "water" …
Run Code Online (Sandbox Code Playgroud)