hey i was wandering if it was possible to show a list:
["one", "two", "three"]
to be shown as
"one", "two", "three"
need it done for a file
开发者_如何学Cthanks
You can do this with intercalate
from Data.List
showList :: Show a => [a] -> String
showList = intercalate ", " . map show
The map show
converts each element to it's string representation with quotes (and any internal quotes properly escaped), while intercalate ", "
inserts commas and spaces between the pieces and glues them together.
精彩评论