-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Natural sorting for strings -- -- A library for sorting strings naturally, i.e. taking numerical -- values into account when comparing textual inputs. -- -- E.g., 1 < 10, and 10 bottles of beer < -- 100 bottles of beer. @package NaturalSort @version 0.2.1 -- | Break textual input into sortable chunks. module Chunk -- | 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". type Chunk = Either Int ByteString -- | Turn a string into a list of Chunks. -- --
-- 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 --toChunks :: ByteString -> [Chunk] -- | Natural sorting for strings. module NaturalSort -- | Sort a list of ByteStrings using natural comparison. natSort :: [ByteString] -> [ByteString] -- | Sort a list of Strings using natural comparison (converts to -- and from ByteString) natSortS :: [String] -> [String]