title: Haskell Powerset in Lexicographic Order
body: <p>I want to write a powerset function in Haskell with the function declaration of:</p>
  
  <pre><code>powerset :: Ord a =&gt; [a] -&gt; [[a]]
  </code></pre>
  
  <p>However, I'm trying to make with a lexicographical ordering so that:</p>
  
  <pre><code>powerset [1,2,3] = [[], [1], [1,2], [1,2,3], [1,3], [2], [2,3], [3]]
  </code></pre>
  
  <p>I've found other ways of doing the powerset, such as:</p>
  
  <pre><code>powerSet = filterM (const [True, False])
  </code></pre>
  
  <p>but nothing that provides the powerset in lexographic order.  Is there any way to write the powerset function to provide that or to sort the unsorted powerset into this ordering?</p>