| Copyright | (c) 2010 John Millikin |
|---|---|
| License | BSD3 |
| Maintainer | jmillikin@gmail.com |
| Portability | portable |
| Safe Haskell | Safe |
| Language | Haskell98 |
Algorithms.NaturalSort
Description
Human-friendly text collation
- data SortKey
- class NaturalSort a where
- compare :: NaturalSort a => a -> a -> Ordering
Documentation
class NaturalSort a where #
Minimal complete definition
Methods
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 -> SortKey #
Split a sortable type into textual and numeric sections, using a custom collation transformation. This is useful for providing language- or use-specific ordering.
Instances
compare :: NaturalSort a => a -> a -> Ordering #
Compare two values, using their natural ordering.