Reputation: 647
I need to convert list like this ["a","b","c"]
to this ['a','b','c']
. The thing is i used
splitOn
function which gave me [[Char]]
from [Char]
. Is there a way to convert this list of string to list of char? Assuming strings are length of 1 of course.
Upvotes: 1
Views: 2377
Reputation: 476709
Yes, you can use concat :: [[a]] -> [a]
:
Prelude> concat ["a","b","c"]
"abc"
Since a String
is a type alias for [Char]
, so "abc"
is short for ['a', 'b', 'c']
:
Prelude> concat ["a","b","c"] == ['a', 'b', 'c']
True
Upvotes: 4
Reputation: 36375
concat ["a", "b", "c"]
will give you the string "abc"
which is the same as ['a', 'b', 'c']
Upvotes: 4