on haskell reddit today

powerSet = filterM (const [True, False])

is said to be beautiful / mind blowing. I just don't get it. I can
play with  transformations until I get

powerSet []       = [[]]
powerSet (x:xs) =
  let pxs = powerSet xs
  in map (x:) pxs ++ pxs

which is understandable to me, but no matter how long I look at the
original filterM definition it just doesn't click.

Is this a uniquely haskell obfu, or is there a way of reading this
definition that makes sense?

If anybody agrees with me, care to throw out other examples of
"obfuscated haskell considered harmful"?
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to