title: Map then filter in Haskell
body: <p>I want to Map an Integer type list in Haskell, and then if the map function returns Nothing I want to discard the result. The function I am trying to write will have a type signature of</p>
  <pre><code>mapThenFilter :: (Integer -&gt; Maybe Integer) -&gt; [Integer] -&gt; [Integer]
  </code></pre>
  <p>and so far, I have thought of doing this:</p>
  <pre><code>checkIfNothing value = case value of 
       Just a -&gt; a
       Nothing -&gt; 0
  
  mapThenFilter = map checkIfNothing(map f l)
  </code></pre>
  <p>But this is incorrect. I am new to Haskell, so if possible can you advise me on where I am going wrong here? I believe since this is Map then Filter, the Haskell filter function is probably expected to be used too, however, I believe the outer map function in my function definition is doing the job intended(of the filter function)right?</p>