> For example, the following zips together two lists:
[ (x, y) | x <- xs | y <- ys ]
For clarity, here's your normal list comprehension (with one pipe) that produces all the combinations instead:
[ (x, y) | x <- xs, y <- ys ]
{-# LANGUAGE ParallelListComp #-} import Control.Monad (mapM) elems = [ "water", "earth", "fire", "air" ] nats = [ "tribes", "kingdom", "nation", "nomads" ] main = mapM putStrLn [ show idx ++ " - " ++ e ++ " " ++ n | e <- elems | n <- nats | idx <- [0..] ]
main = forM (zip3 elems nats [0..]) $ \(e, n, idx) -> putStrLn (show idx ++ " - " ++ e ++ " " ++ n)
main = mapM putStrLn $ do (e, n, idx) <- zip3 elems nats [0..] [ show idx ++ " - " ++ e ++ " " ++ n ]