However, x in the generator expression is not just variable, but can be any pattern. In cases of pattern mismatch the generated element is skipped over, and processing of the list continues with the next element, thus acting like a filter:
[x | Just x <- [Just 1, Nothing, Just 3]] -- [1, 3]
...