Memory-efficient ShortText type for many short Unicode strings in Haskell
open sourceBSD-3-Clausefree
text-short is a Haskell package that provides the ShortText type, for keeping many short Unicode strings in memory, as ShortByteString does for ByteString. Unlike Text, ShortText gives up zero-copy slicing to save two words per value and stores UTF-8 rather than text-1's UTF-16, so a boxed value takes four words (two unboxed) plus its UTF-8 bytes. It has Data, Typeable and Template Haskell Lift instances.
Problems it solves
- my Haskell program holds millions of short Text values and uses too much memory
- store short Unicode keys compactly in a Haskell map
- a UTF-8 string type for Haskell that's smaller than Text
Features
- ShortText: UTF-8 strings without slicing overhead
- four words per boxed value plus the UTF-8 payload
- Data, Typeable and Template Haskell Lift instances
Alternatives
The same job
These do what text-short does.
- text Efficient packed Unicode text for Haskell
- bytestring Fast, compact strict and lazy byte strings for Haskell
- case-insensitive Haskell type for case-insensitive comparison of String, Text or ByteString
- string-interpolate Unicode-aware string interpolation for Haskell that handles all textual types
