title: All possible combinations of a list's elements
body: <p>I need to get all possible combinations of a list's elements. I tried the solution <a href="https://stackoverflow.com/questions/9658409/haskell-combinations-and-permutation/9663864?noredirect=1#comment63023943_9663864">here</a> but it does not compile. Please help me figure this out:</p>
  
  <pre><code>subseq :: [a] -&gt; [[a]]
  subseq [] = []
  subseq (x:xs) = map (x :) $ subseq xs
  </code></pre>
  
  <p>Basically this is a rewrite of the <code>subsequences</code> function in <code>Data.List</code>. I dont understand the version in the <a href="http://hackage.haskell.org/package/base-4.9.0.0/docs/src/Data.OldList.html#subsequences" rel="nofollow noreferrer">source</a> though. My rationale behind the function above is this.</p>
  
  <p>Apply the cons operator across all elements. This should produce a non deterministic result. However, the result I'm getting is an empty list. Please help.</p>