Thomas Hartman wrote:
on haskell reddit today

powerSet = filterM (const [True, False])


Does it help if we inline the 'const' function and rewrite [True, False] in monadic notation as (return True `mplus` return False)?

powerSet = filterM (\x -> return True `mplus` return False).

You can see that 'x' is ignored, both True and False are returned, hence x is preserved in one answer and not preserved in another.

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to