
I'm looking at Bird's *Thinking Functionally with Haskell *and he gives two list comprehensions, asking under what conditions they deliver the same results [e | x <- xs, p x, y <- ys] [e | x <- xs, y <- ys, p x] First, I'm confused about what is the input and what is the predicate. The y <- ys in the first LC seems to be in a predicate position, and in the second it's a second input after x <- xs with p x in the predicate position . . . confusing me. The answer examples Bird gives are beyond me: They deliver the same result only if ys is a finite list:
[1 | x <- [1,3], even x, y <- undefined] [] [1 | x <- [1,3], y <- undefined, even x] Exception: Prelude.undefined [1 | x <- [1,3], y <- [1..], even x] {Interruped}
I'm not sure what's being said here, or what points are being made.