[Haskell-cafe] version sorting?

Iustin Pop iustin at k1024.org
Sat Dec 8 13:31:25 UTC 2018


On 2018-12-08 11:38:15, Francesco Ariis wrote:
> Hello Jarvan,
> 
> On Fri, Dec 07, 2018 at 05:47:44PM -0800, Javran Cheng wrote:
> > I'm wondering if there's any existing packages that do "version sorting":
> > as an example, for a list like:
> 
>     https://hackage.haskell.org/package/natural-sort
> 
>     λ> :m +Algorithms.NaturalSort
>     λ> :m +Data.List
>     λ> sortBy (Algorithms.NaturalSort.compare) ["foo-10.20", "foo-1.2", "foo-2.100", "foo-1.12"]
>     ["foo-1.2","foo-1.12","foo-2.100","foo-10.20"]

Does it really sort 1.2 before 1.12? (or is it just a copy-paste error)

curious,
iustin


More information about the Haskell-Cafe mailing list