[Haskell-cafe] Parse text difficulty

Thomas Johnsson thomas at skri.net
Fri Dec 10 10:30:39 EST 2004


> printastable :: [([Int],Word)] -> String
>
> printastable l = concat $ map (\(xs,w) -> (show xs) ++ " " ++ w ++
> "\n") l

I'd use

[ c | (xs,w) <- l, c <- (show xs) ++ " " ++ w ++ "\n" ]

instead -- after all, list comprehensions provide a much nicer
syntax for map, filter and concat.
-- Thomas




More information about the Haskell-Cafe mailing list