[Haskell-cafe] Strings - why [Char] is not nice
Einar Karttunen
ekarttun at cs.helsinki.fi
Mon Sep 20 15:50:07 EDT 2004
On 20.09 15:05, Dylan Thurston wrote:
> You know about the PackedString functions, right?
>
> http://www.haskell.org/ghc/docs/6.0/html/base/Data.PackedString.html
Yes, but they are quite broken. I am using FastPackedString from
darcs for many purposes, which is like PackedString in many
ways.
PackedStrings use full unicode codepoints (4*size in bytes), but
having a char > 256 in them does not work if one wants to do IO.
This means essentially that the wasted space cannot be used in any
meaningfull way.
Also concatenating PackedStrings is not very nice:
concatPS pss = packString (concat (map unpackPS pss))
And most important they need a conversion (unpackPS), before
using them with external libraries which expect Strings.
- Einar Karttunen
More information about the Haskell-Cafe
mailing list