title: F#: Nested discriminated unions and matching
body: <p>I have 2 nested discriminated unions:</p>
  
  <pre><code>type ServiceTypes =
      | Contexts
      | Context of int
      | Producers
  
  type ServiceActions =
      | Get of ServiceTypes
      | Update of ServiceTypes
  </code></pre>
  
  <p>And a nested match statement:</p>
  
  <pre><code>let s_action = match action with
                 | Get(stype) -&gt; sprintf "Get%s" (match stype with
                                                  | Contexts -&gt; sprintf "Contexts"
                                                  | Context(id)  -&gt; (sprintf "Context/%d" id))
                                                  | _ -&gt; raise (RequestException("get"))
                 | Update(stype) -&gt; sprintf "Update%s" (match stype with
                                                        | Producers -&gt; (sprintf "Producers")
                                                        | _ -&gt; raise (RequestException("update")))
  </code></pre>
  
  <p>The goal is to build a request string with a call looking like that <code>req.Send(Update Producers)</code>.</p>
  
  <p>Anyway for a reason that I do not understand, the compiler gives me 2 warnings:</p>
  
  <ol>
  <li>on the <code>Update(stype)</code> I get a <strong>This rule will never be matched</strong></li>
  <li>on the the first <code>match stype</code> I get a <strong>Incomplete pattern matches on this expression. For example, the value 'Producers' may indicate a case not covered by the pattern(s).</strong></li>
  </ol>
  
  <p>So the question is why do I get these 2 warnings? Did I miss something on the way matching works?</p>