How do I convert a list of chars to a string in purescript
I agree with your edit. Data.String.fromCharArray <<< Data.List.fromList
sounds pretty decent to me. fromCharArray
is implemented in native JS with array.join("")
.
Update: fromList
is deprecated now - use toUnfoldable
instead
[Updated Jan 2021]
In PureScript 0.13.8:
import Prelude
> import Data.Array (toUnfoldable)
> import Data.String.CodeUnits (fromCharArray)
> fromListChars = fromCharArray <<< toUnfoldable
> fromListChars ['2', '0', '2', '1']
"2021"
> fromListChars []
""