text: Q:
  
  F# error FS0193 (VS 2010) : The type 'WebRequest' is not compatible with the type 'HttpWebRequest'
  
  Recently I work in a CBIR student project. And we need lots of photos of world landmarks. I've found this Flickr Crawler project (blog, sourcecode) written in F#. But I encounter an error when building it in my Visual Studio 2010:
  error FS0193: 
  Type constraint mismatch. The type WebRequest is not compatible with type HttpWebRequest . The type 'WebRequest' is not compatible with the type 'HttpWebRequest'
  Line 2 (let req=...) is where the error happens:
  let downloadUrl(url:string) = 
      let req = HttpWebRequest.Create(url) :> HttpWebRequest
      req.UserAgent <- "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)";
      req.Method <- "GET";
      req.AllowAutoRedirect <- true;
      req.MaximumAutomaticRedirections <- 4;
      req.MaximumAutomaticRedirections <- 4;
      let resp = req.GetResponse()
      let stream = resp.GetResponseStream()
      let reader = new StreamReader(stream)
      reader.ReadToEnd()
  
  I did not learn F# before so I am not familiar with F#. What does this error message suggest and how do I solve it?
  
  A:
  
  The error was quite small.  The :> operator will only perform casts which are known to succeed at compile time and so won't cast from HttpWebRequest.Create(url) to HttpWebRequest as this actually returns a WebRequest.  As a reult you need to use 
   let req = HttpWebRequest.Create(url) :?> HttpWebRequest
  
  instead to allow for casting in the other direction in the inheritance tree.  The difference is that casts made by :?> may fail at run time (but shouldn't in this case as all urls should be http)
  
  