3 ms·
Yes, there's now `Data.Text` https://hackage.haskell.org/package/text-2.0/docs/Data-Text.html https://hackage.haskell.org/package/text-2.0/docs/Data-Text.... wh
by _query 5y ago
Yes, there's now `Data.Text` https://hackage.haskell.org/package/text-2.0/docs/Data-Text.html https://hackage.haskell.org/package/text-2.0/docs/Data-Text.... which is widely supported
- misja111 5y agoHuh, Data.Text has been around forever. And the datatype that you will find in almost any Haskell tutorial is still 'String'. It is really a pain that any beginner in the Haskell language is learning what seems the obvious datatype for strings, i.e. String, and later has to unlearn that again.
- stingraycharles 5y agoIt’s been a while since I worked with Haskell. What’s the issue with Strings, I’m guessing it must be Unicode-related?
- mylvinta 5y agoStrings are linked lists of characters, so they perform quite badly
- nextaccountic 5y agoThe real fix will happen when Data.Text moves from UTF-16 to UTF-8: https://discourse.haskell.org/t/hf-tech-proposal-1-utf-8-encoded-text/2499 https://discourse.haskell.org/t/hf-tech-proposal-1-utf-8-enc... Fortunately this proposal has been accepted, but I don't know the timeline for its implementation in GHC. Until then, working with UTF-8 is kind of convoluted https://serokell.io/blog/haskell-with-utf8 https://serokell.io/blog/haskell-with-utf8 Also: libraries need to be fixed to accept Data.Text instead of String. IsString helps (it's a typeclass that contains all string types) but only if APIs take it instead of defaulting to String. Adding random string conversions to cope with legacy APIs is very annoying.
- tome 5y ago> The real fix will happen when Data.Text moves from UTF-16 to UTF-8: This work was completed a while ago. https://hackage.haskell.org/package/text-2.0/changelog https://hackage.haskell.org/package/text-2.0/changelog > I don't know the timeline for its implementation in GHC. Data.Text is a library, not a compiler feature, so completing it was not tied to GHC.
- carterschonwald 5y agoThe most recent release is utf8
- sekun 5y agoUTF-8 as the de facto for `text` was merged a few months ago. It's in >=2.0.