Type annotation for using a F# TypeProvider type e.g. FSharp.Data.JsonProvider<...>.DomainTypes.Url
f#, f#-data, type-parameter, type-providers
Solution
When you call `Twitter.Search.Tweets` (https://github.com/tpetricek/Documents/blob/master/Samples/Twitter.API/Twitter.fs#L284), the return type of that is one of the domain types of `TwitterTypes.SearchTweets`, which is a type alias for `JsonProvider<"references\\search_tweets.json">` (https://github.com/tpetricek/Documents/blob/master/Samples/Twitter.API/Twitter.fs#L183).
Although in the tooltip it shows up as `JsonProvider<...>.DomainTypes.Url`, you'll have to use the type alias `TwitterTypes.SearchTweets.DomainTypes.Url`
Problem
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 constrain the type of the object. ``` My problem is how to define the `TypeProvider` Type for url in the expandUrl function above? The type inferance shows me this ``` val urls : FSharp.Data.JsonProvider<...>.DomainTypes.Url [] ``` but this is not accepted in the type declaration. I assume "<...>" is not F# synatx. How to do a type annotation for using a TypeProvider type e.g. `FSharp.Data.JsonProvider<...>.DomainTypes.Url ?` Here is the complete code snippet: ``` open TwitterAPI // github.com/tpetricek/Documents/tree/master/Samples/Twitter.API let twitter = TwitterAPI.TwitterContext( _consumerKey, _consumerSecret, _accessToken, _accessTokenSecret ) let query = "water" let ts = Twitter.Search.Tweets(twitter, Utils.urlEncode query, count=100) let ret = [ for x in ts.Statuses do // val urls : FSharp.Data.JsonProvider<...>.DomainTypes.Url [] let urls = x.Entities.Urls // fully declarated to help the type inference at expandUrl let replace (txt:string) (oldValue:string) (newValue:string) = txt.Replace( oldValue, newValue) // 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 constrain the type of the object. // This may allow the lookup to be resolved. let expandUrl (txt:string) (url:FSharp.Data.JsonProvider<_>.DomainTypes.Url) = replace txt url.Url url.ExpandedUrl let textWithExpandedUrls = Array.fold expandUrl x.Text urls yield textWithExpandedUrls ] ```