List comprehensions: Difference between revisions

Content added Content deleted
(→‎{{header|Haskell}}: Added a test to the desugared version)
(→‎{{header|Haskell}}: variation of first desugaring)
Line 846: Line 846:
[y .. n] >>=
[y .. n] >>=
(\z ->
(\z ->
if x ^ 2 + y ^ 2 == z ^ 2
case x ^ 2 + y ^ 2 == z ^ 2 of
then [(x, y, z)]
True -> return (x, y, z)
else [])))</lang>
False -> [])))</lang>


which can be further specialised (given the particular context of the list monad, in which >>= is concatMap) to:
which can be further specialised (given the particular context of the list monad, in which >>= is concatMap) to: