fork download
  1. main = mapM_ print $ combinations [["England"],["London","Liverpool"],["DG300","SS500"]]
  2.  
  3. combinations :: [[String]] -> [[String]]
  4. combinations [] = [[]]
  5. combinations (x:xs) = do
  6. ys <- combinations xs
  7. y <- x
  8. return (y:ys)
Success #stdin #stdout 0s 8388607KB
stdin
Standard input is empty
stdout
["England","London","DG300"]
["England","Liverpool","DG300"]
["England","London","SS500"]
["England","Liverpool","SS500"]