quiver-sort-0.1.0.0: Sort the values in a quiver

Copyright(c) Ivan Lazar Miljenovic
LicenseMIT
MaintainerIvan.Miljenovic@gmail.com
Safe HaskellNone
LanguageHaskell2010

Control.Quiver.Sort

Contents

Description

 

Synopsis

In-memory sorting

These Quivers require reading all the values from the quiver before being able to sort them. As such, it is highly recommended you only use them for short streams.

spsort :: (Ord a, Monad m) => SP a a m () Source

spsortBy :: Monad m => (a -> a -> Ordering) -> SP a a m () Source

Use the specified comparison function to sort the values.

spsortOn :: (Ord b, Monad m) => (a -> b) -> SP a a m () Source

Use the provided function to be able to compare values.

File-based sorting

For large Quivers it may not be possible to sort the entire stream in memory. As such, these functions work by sorting chunks of the stream and storing them in temporary files before merging them all together.

spfilesort :: (Binary a, Ord a, MonadResource m, MonadMask m) => Maybe Int -> Maybe FilePath -> P () a a () m (SPResult IOException) Source

Use external files to temporarily store partially sorted results (splitting into chunks of the specified size if one is provided).

These files are stored inside the specified directory if provided; if no such directory is provided then the system temporary directory is used.

spfilesortBy :: (Binary a, MonadResource m, MonadMask m) => (a -> a -> Ordering) -> Maybe Int -> Maybe FilePath -> P () a a () m (SPResult IOException) Source

Use external files to temporarily store partially sorted (using the comparison function) results (splitting into chunks of the specified size if one is provided).

These files are stored inside the specified directory if provided; if no such directory is provided then the system temporary directory is used.