title: Array of 'a option
body: <p>I have a function </p>
  
  <pre><code>foo 'a -&gt; 'b option
  </code></pre>
  
  <p>and I have a n array of 'a</p>
  
  <pre><code>let data_in: 'a[] = ...
  </code></pre>
  
  <p>I need to get array of 'b.  So I have two question:</p>
  
  <ol>
  <li><p>I want to do something like this:</p>
  
  <pre><code>bar(data: 'a []) : 'b [] = 
    data |&gt; foo
  
  let result : 'b[] = Array.filter (fun e -&gt; 
                                       match e with
                                       | Some(e) -&gt; true
                                       | None -&gt; false)
  </code></pre></li>
  </ol>
  
  <p>but I get the error that <code>bar</code> expected type <code>'b</code>, but get <code>'b option</code>. How can I fix the type declaration in <code>bar</code> ?</p>
  
  <ol start="2">
  <li>May be there is a way to do all this without <code>map</code> + <code>filter</code> by one expression ?</li>
  </ol>