conduit-algorithms-0.0.2.0: Conduit-based algorithms

Copyright2013-2017 Luis Pedro Coelho
LicenseMIT
Maintainerluis@luispedro.org
Safe HaskellNone
LanguageHaskell2010

Data.Conduit.Algorithms.Async

Description

Higher level async processing interfaces.

Synopsis

Documentation

conduitPossiblyCompressedFile :: (MonadBaseControl IO m, MonadResource m) => FilePath -> Source m ByteString Source #

If the filename indicates a gzipped file (or, on Unix, also a bz2 file), then it reads it and uncompresses it.

For the case of gzip, asyncGzipFromFile is used.

asyncMapC :: forall a m b. (MonadIO m, NFData b) => Int -> (a -> b) -> Conduit a m b Source #

This is like Data.Conduit.List.map, except that each element is processed in a separate thread (up to maxSize can be queued up at any one time). Results are evaluated to normal form (not WHNF!) to ensure that the computation is fully evaluated before being yielded to the next conduit.

asyncMapEitherC :: forall a m b e. (MonadIO m, NFData b, NFData e, MonadError e m) => Int -> (a -> Either e b) -> Conduit a m b Source #

asyncMapC with error handling. The inner function can now return an error (as a Left). When the first error is seen, it throwErrors in the main monad. Note that f may be evaluated for arguments beyond the first error (as some threads may be running in the background and already processing elements after the first error).

asyncGzipTo :: forall m. (MonadIO m, MonadBaseControl IO m) => Handle -> Sink ByteString m () Source #

A simple sink which performs gzip in a separate thread and writes the results to h.

See also asyncGzipToFile

asyncGzipToFile :: forall m. (MonadResource m, MonadBaseControl IO m) => FilePath -> Sink ByteString m () Source #

Compresses the output and writes to the given file with compression being performed in a separate thread.

See also asyncGzipTo

asyncGzipFrom :: forall m. (MonadIO m, MonadResource m, MonadBaseControl IO m) => Handle -> Source m ByteString Source #

A source which produces the ungzipped content from the the given handle. Note that this "reads ahead" so if you do not use all the input, the Handle will probably be left at an undefined position in the file.

See also asyncGzipFromFile

asyncGzipFromFile :: forall m. (MonadResource m, MonadBaseControl IO m) => FilePath -> Source m ByteString Source #

Open and read a gzip file with the uncompression being performed in a separate thread.

See also asyncGzipFrom