title: How do I use the filter function in Haskell?
body: <p>I have a haskell program to list all integers from [1..n] based on the input n.
  I want to filter certain numbers based on a condition from it and display as a list. where and how can I use the filter function / condition?</p>
  
  <p>According to haskell documentation: </p>
  
  <pre><code>filter :: (a -&gt; Bool) -&gt; [a] -&gt; [a]
  </code></pre>
  
  <p>filter, applied to a predicate and a list, returns the list of those elements that satisfy the predicate; i.e.,</p>
  
  <pre><code>filter p xs = [ x | x &lt;- xs, p x]
  </code></pre>