title: How to do the equivalent of pattern matching on native .NET types?
body: <pre><code>let print_type_c (x: Type)= 
      if x = typeof&lt;Int32&gt; then "int"
      elif x = typeof&lt;Single&gt; then "float"
      elif x = typeof&lt;Tuple&lt;_&gt;&gt; then "tuple"
      elif x = typeof&lt;FSharpFunc&lt;Tuple&lt;'inp&gt;,'out&gt;&gt; then "function..."
      else failwithf "Not supported(%A)" x
  
  print_type_c (typeof&lt;int&gt;) // prints int
  print_type_c (typeof&lt;float32&gt;) // prints float
  print_type_c (typeof&lt;int*int&gt;) // throw an exception
  </code></pre>
  
  <p>I am trying to build a primitive F# quotations to Cuda compiler and I need to figure out how to translate tuple types to C struct types in function declarations, but I am really not familiar with how the .NET machinery works. It is disappointing that F# quotations do not return you a nice AST based on discriminated unions which would make everything explicit, but unless I want to do the typechecking myself, I'll have work with this.</p>
  
  <p>What I am asking is - is there a way to the crappy piece of code above with pattern matching on .NET <code>Type</code>s, because the above is clearly not working.</p>
  
  <p>Edit: The question is not a duplicate because that linked question is asking how to print the properties of F# records, while I am asking how to print the types of native .NET types (including functions) inside F# quotations. A visual scan of the accepted answer here and there should show that they are completely different and not even using the same functions.</p>