Portability | unportable |
---|---|
Stability | unstable |
Maintainer | joachim.fasting@gmail.com |
Break textual input into sortable chunks.
- type Chunk = Either Int ByteString
- toChunks :: ByteString -> [Chunk]
Documentation
type Chunk = Either Int ByteStringSource
A chunk is either a pure integral value, or a string that might contain digits, letters and other characters.
When preparing strings for natural comparison, they are first broken into several chunks, which can then be compared and ordered "naturally".
toChunks :: ByteString -> [Chunk]Source
Turn a string into a list of Chunk
s.
toChunks "a12x.txt" = [S "a", N 12, S "x.txt"] toChunks "7" `compare` toChunks "10" = LT toChunks "a7.txt" `compare` toChunks "a10.txt" = LT toChunks "7a.txt" `compare` toChunks "10a.txt" = LT