title: How to remove Empty Lists from a nested List using comprehension in Haskell
body: <p>I just started learning Haskell and I started looking into understanding comprehension which allows me to form a subset by giving conditions to a bigger set.</p>
  
  <p>I tried to make a comprehension that takes a nested list (containing other integer lists) and removes all the positive odd numbers from them and empty inner lists.</p>
  
  <pre><code>testList= [-3]:[-5,8]:[[1,3,5,7,9],[],[4,6,8,10],[1,3,6,7,9],[],[1]]
  
  removingOnlyPosOdds xxs = [ [x | x &lt;-xs, not (odd x &amp;&amp; x &gt; 0 )] | xs &lt;- xxs, [] /= xs ] 
  
  </code></pre>
  
  <p><code>testList</code> before applying the comprehension function on it looked like:</p>
  
  <p><code>[[-3],[-5,8],[1,3,5,7,9],[],[4,6,8,10],[1,3,6,7,9],[],[1]]</code></p>
  
  <p>After applying <code>removingOnlyPosOdds</code> testList</p>
  
  <pre><code>The outcome was 
  [[-3],[-5,8],[],[4,6,8,10],[6],[]] 
  </code></pre>
  
  <hr>
  
  <p>So what I realised that <code>"[] /= xs"</code> in the function description was removing the already existent </p>
  
  <p><code>"[]"</code> inner lists in <code>testList</code> only; but not the new ones that were formed caused by me removing positive odd numbers from the inner lists.</p>
  
  <p>What should be my next step in order to remove those as well code wise?</p>
  
  <p>I want it to look like</p>
  
  <p><code>[[-3],[-5,8],[4,6,8,10],[6]]</code></p>
  
  <p>Is there a way to generalise the comprehension to do it in one go? </p>
  
  <p>Or is there another approach which would be much better to deal with the removal of things (like the empty inner lists )and to make a more specified set?</p>