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

Reply via email to