
17 Jul
2009
17 Jul
'09
8:29 a.m.
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