[Haskell-cafe] Grapheme length?

amindfv at mailbox.org amindfv at mailbox.org
Sat Feb 20 01:05:12 UTC 2021


Does there exist a Haskell library or function for getting grapheme lengths of String/Text values?

e.g. right now,

    Prelude.length ("ä" :: String) == 2
    Data.Text.length ("ä" :: Text) == 2

But I'd like, either for String or Text, to get 1 instead (there are 2 code points but only 1 grapheme).

Thanks,
Tom


More information about the Haskell-Cafe mailing list