[Haskell-cafe] Heavy lift-ing

Alex Stangl alex at stangl.us
Fri Jul 23 23:07:09 EDT 2010

On Fri, Jul 23, 2010 at 09:12:44PM -0500, aditya siram wrote:
> Lists are non-deterministic, but the function taken by liftM2 does not
> necessarily generate all possible outcomes. In the case of (+) it
> does, not in the case of (-):
> liftM2 (-) [0,1] [2,3] => [0-1,0-2,1-2,1-3] => [-2,-3,-1,-2]
> if all possible cases were generated between the two lists we have to
> include also:
> [2-0,2-1,3-0,3-1]

If I have a - b where a and b are both non-deterministic, I wouldn't
expect to also include in my solution set all the results of b - a.
What if you have a / b? Would you try to include b / a, too, even
though some values of a may be zero?


More information about the Haskell-Cafe mailing list