Haskell Package Selection

On the same day, everyone used text processing with String . But then some people noted that it was actually very, very inefficient, and the ByteString package ByteString .

ByteString great for processing binary data. But people soon noticed that ByteString.Char8 is actually a massive kludge, and what you really want is the actual Unicode processing for external data. And with that, about thirty similar, but incompatible Haskell packages for working with Unicode packed strings were born. And none of them can really get any craving, because ... well, thirty is too much!

My question is: is this problem still fixed? In other words, has the community settled on one package to do the job? And if so, which one?

+7
unicode haskell
source share
1 answer

I believe the current gold standard is Data.Text , which you can set with

 $ cabal install text 

and which you should import as

 import qualified Data.Text as T 

You create Text values ​​in your code either by explicit input from String , as in

 >> let str = T.pack "Hello, world" 

or using the language extension OverloadedStrings

 >> :set -XOverloadedStrings >> let str = "Hello, world" :: Text 
+11
source share

All Articles