Thomas Hartman wrote: > on haskell reddit today > powerSet = filterM (const [True, False]) > > is said to be beautiful / mind blowing. > Is this a uniquely haskell obfu, or is there a way of reading this > definition that makes sense?
To me, these are more obvious: powerSet = map catMaybes . mapM ((mzero:).return.return) powerSet = map concat . mapM ((mzero:).return.return) They work by pretty much the same principle. Perhaps they seem simpler to me only because I use mapM a lot more than I use filterM. Regards, Yitz _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe