[Haskell-cafe] powerSet = filterM (const [True, False]) ... is this obfuscated haskell?

Ryan Ingram ryani.spam at gmail.com
Tue Jul 28 13:10:44 EDT 2009

On Tue, Jul 28, 2009 at 6:47 AM, Sebastian
Fischer<sebf at informatik.uni-kiel.de> wrote:
>>> perms = sortByM (const [True,False])
> Hence, perm as defined above can yield a list that contains all permutations
> of the input (at least once) regardless of the sorting algorithm.
> Where is the hitch?

The algorithm might diverge when given a non-transitive comparison
operator.  On Spore we had a bug where a NaN got into a list of floats
we were sorting and our quicksort corrupted the heap because < isn't
transitive on lists with NaNs.

  -- ryan

More information about the Haskell-Cafe mailing list