title: Accessing specific case from F# DU
body: <p>Suppose I have the following DU:</p>
  
  <pre><code>type Something =
  | A of int
  | B of string * int
  </code></pre>
  
  <p>Now I use it in a function like this:</p>
  
  <pre><code>let UseSomething = function
  | A(i) -&gt; DoSomethingWithA i
  | B(s, i) -&gt; DoSomethingWithB s i
  </code></pre>
  
  <p>That works, but I've had to deconstruct the DU in order to pass it to the DoSomethingWith* functions. It feels natural to me to try to define DoSomethingWithA as:</p>
  
  <pre><code>let DoSomethingWithA (a: Something.A) = ....
  </code></pre>
  
  <p>but the compiler complains that the type A is not defined.</p>
  
  <p>It seems entirely in keeping with the philosophy of F# to want to restrict the argument to being a Something.A, not just any old int, so am I just going about it the wrong way?</p>