简体   繁体   中英

String in Haskell that supports UTF-16 and constant time indexing

I know of bytestring, compactstring, text, and a bunch of other Haskell strings, but I did not find any that supports UTF-16 and constant time indexing, like bytestring does.

Does this exist?

The usual text interface doesn't support this because it's very rarely useful. However, the package maintainers have continued to use UTF-16 for years despite it being a silly encoding. Therefore, you might be justified in taking a gamble and importing Data.Text.Internal to get at the underlying Array . That said, this is so rarely the right thing to do that I suspect you may be asking the wrong question. Why do you need this?

Note: this question inspired me to file an issue suggesting that text switch to UTF-8. This will likely be denied, but I figured I should mention it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM