samsort
is a lightweight sorting library that operates on GHC MutableArray#
s. There are no dependencies outside of base
.
Candidate release:
https://hackage.haskell.org/package/samsort-0.1.0.0/candidate
I put it together since I could not find any other library in this niche.
vector-algorithms
is the closest and has good implementations of sorting algorithms, but as the name indicates it depends and operates on vector
s.
The library is not released yet, since I might tweak the internals some more, but I welcome any feedback in the meantime.
Update
I’ve decided to add another function to sort ints, and I’ve changed both functions to work in ST
. This is equivalent to before, but it should be a little more convenient to use this way.
There is now a HOWTO
showing how the library can be used.
The benchmark suite has grown larger and covers sort functions from samsort
, vector-algorithms
, primitive-sort
applied to different element types in different distributions. It’s good to see that samsort
is the fastest in almost all cases, and comes in second when it’s not