-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Sorting streams
--
-- Sort streaming values, using files for a cached merge-sort of long
-- Streams.
@package streaming-sort
@version 0.1.0.2
-- | This module is designed to be imported qualified.
module Streaming.Sort
-- | Sort the values based upon their Ord instance.
sort :: (Monad m, Ord a) => Stream (Of a) m r -> Stream (Of a) m r
-- | Use the specified comparison function to sort the values.
sortBy :: (Monad m) => (a -> a -> Ordering) -> Stream (Of a) m r -> Stream (Of a) m r
-- | Use the provided function to be able to compare values.
sortOn :: (Ord b, Monad m) => (a -> b) -> Stream (Of a) m r -> Stream (Of a) m r
-- | 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.
withFileSort :: (Ord a, Binary a, MonadMask m, MonadIO m, MonadThrow n, MonadIO n) => Config -> Stream (Of a) m v -> (Stream (Of a) n () -> m r) -> m r
-- | 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.
withFileSortBy :: (Binary a, MonadMask m, MonadIO m, MonadThrow n, MonadIO n) => Config -> (a -> a -> Ordering) -> Stream (Of a) m v -> (Stream (Of a) n () -> m r) -> m r
data SortException
SortIO :: IOException -> SortException
SortDecode :: Int64 -> String -> SortException
data Config
-- | Default settings for sorting using external files:
--
--
-- - Have a chunk size of 1000.
-- - No more than 100 temporary files to be open at a
-- time.
-- - Use the system temporary directory.
--
defaultConfig :: Config
-- | A specialised variant of set from lens, microlens, etc.
-- defined here in case you're not using one of those libraries.
setConfig :: (forall f. (Functor f) => (a -> f a) -> Config -> f Config) -> a -> Config -> Config
chunkSize :: (Functor f) => (Int -> f Int) -> Config -> f Config
maxFiles :: (Functor f) => (Int -> f Int) -> Config -> f Config
useDirectory :: (Functor f) => (Maybe FilePath -> f (Maybe FilePath)) -> Config -> f Config
instance GHC.Show.Show Streaming.Sort.SortException
instance GHC.Show.Show Streaming.Sort.Config
instance GHC.Exception.Exception Streaming.Sort.SortException
module Streaming.Sort.Lifted
-- | Sort the values based upon their Ord instance.
sort :: (Monad m, Ord a) => Stream (Of a) m r -> Stream (Of a) m r
-- | Use the specified comparison function to sort the values.
sortBy :: (Monad m) => (a -> a -> Ordering) -> Stream (Of a) m r -> Stream (Of a) m r
-- | Use the provided function to be able to compare values.
sortOn :: (Ord b, Monad m) => (a -> b) -> Stream (Of a) m r -> Stream (Of a) m r
-- | 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.
withFileSort :: (Ord a, Binary a, Withable w, MonadThrow m, MonadIO m) => Config -> Stream (Of a) (WithMonad w) v -> w (Stream (Of a) m ())
-- | 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.
withFileSortBy :: (Binary a, Withable w, MonadThrow m, MonadIO m) => Config -> (a -> a -> Ordering) -> Stream (Of a) (WithMonad w) v -> w (Stream (Of a) m ())
data SortException
SortIO :: IOException -> SortException
SortDecode :: Int64 -> String -> SortException
data Config
-- | Default settings for sorting using external files:
--
--
-- - Have a chunk size of 1000.
-- - No more than 100 temporary files to be open at a
-- time.
-- - Use the system temporary directory.
--
defaultConfig :: Config
-- | A specialised variant of set from lens, microlens, etc.
-- defined here in case you're not using one of those libraries.
setConfig :: (forall f. (Functor f) => (a -> f a) -> Config -> f Config) -> a -> Config -> Config
chunkSize :: (Functor f) => (Int -> f Int) -> Config -> f Config
maxFiles :: (Functor f) => (Int -> f Int) -> Config -> f Config
useDirectory :: (Functor f) => (Maybe FilePath -> f (Maybe FilePath)) -> Config -> f Config