Portability | portable |
---|---|
Maintainer | jmillikin@gmail.com |
Safe Haskell | Safe-Infered |
Human-friendly text collation
- data SortKey
- class NaturalSort a where
- sortKey :: a -> SortKey
- sortKeyCollated :: (Text -> ByteString) -> a -> SortKey
- compare :: NaturalSort a => a -> a -> Ordering
Documentation
class NaturalSort a whereSource
Split a sortable type into textual and numeric sections, with no collation transformation.
If advanced collation is required, either pre-transform the input
(using eg toLower
) or use sortKeyCollated
.
sortKeyCollated :: (Text -> ByteString) -> a -> SortKeySource
Split a sortable type into textual and numeric sections, using a custom collation transformation. This is useful for providing language- or use-specific ordering.
compare :: NaturalSort a => a -> a -> OrderingSource
Compare two values, using their natural ordering.