I have a list of tuples [(1,'a','%',"yes"),(2,'b','[',"no"),(3,'c',']',"ok")]
.
How can I show this list as output in the form开发者_高级运维 of [(1,a,%,yes),(2,b,[,no),(3,c,],ok)]
?
Looks like the transformation you wish to make is to strip out quote characters? If so, filtering the results of calling show
on your data will be enough:
> let x = [(1,'a','%',"yes"),(2,'b','[',"no"),(3,'c',']',"ok")]
Then apply a filter,
> putStrLn . filter (`notElem` "'\"") . show $ x
[(1,a,%,yes),(2,b,[,no),(3,c,],ok)]
Once you know that show
turns a data structure into a pretty string, processing that string to make minor modifications is pretty easy.
精彩评论