Reputation: 53
I have [(Double, Double)]
returned list and I want to format it and return it like this String
"(Double, Double)"
values must convert to String mentioned above line as Double
.
If there is more than one value in the list, it should be formatted as:
"(Double, Double), (Double, Double), ..., (Double, Double)"
Upvotes: 0
Views: 441
Reputation: 35089
If you actually want to print the specific values of the Double
s, then efie
gave the correct answer. However, if you only want to show the string "Double"
, then you would use the following answer:
format = intercalate ", " . map (const "(Double, Double)")
Upvotes: 1
Reputation: 26167
You can use the native Show
instance of the list:
showPairSequence :: [(Double, Double)] -> String
showPairSequence = init . tail . show
Upvotes: 0