That... sounds awful for performance. Is that a real thing?
That... sounds awful for performance. Is that a real thing?
Haskell's type class capability (similar to traits or interfaces) was still new/experimental at that time, and one benefit of strings as lists is it allowed them to easily be manipulated using the same syntactic and semantic machinery - pattern matching, recursive processing etc. - as other list data.
These days real, non-trivial code uses much more optimized string representations, but the original String type still exists and is used in various standard library functions, like "error". But as the original commenter pointed out, "you can just upgrade strings like any other dependency," so if you want, you can always import some other library that uses e.g. the Text type for error message, if you care for some reason.
The performance is good enough for teaching and learning and mocking out examples... But the reason for the user libraries is that real string processing workloads need something way better as their default.
It generalizes really well to Unicode; encoding is unnecessary. :p
On the other hand, I think the name of the function that converts an integer to its own string representation, integer_to_list, could have been chosen better.