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
thanks
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.