[Haskell-cafe] powerSet = filterM (const [True, False]) ... is
this obfuscated haskell?
George Pollard
porges at porg.es
Fri Jul 17 06:23:59 EDT 2009
For each item, we ignore what the item actually is (hence `const`),
and say that we both want it (True) and don't want it (False) in the
output. Since we are using the list monad we are allowed to say this,
and the filter function gives us a list of lists. I think there's
probably a more intuitive name for `filterM`...
More information about the Haskell-Cafe
mailing list