-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Streaming data processing library. -- -- Conduits are an approach to the streaming data problem. It is meant as -- an alternative to enumerators/iterators, hoping to address the same -- issues with different trade-offs based on real-world experience with -- enumerators. For more information, see -- http://www.yesodweb.com/book/conduits. -- -- Release history: -- -- @package conduit @version 0.4.2 module Data.Conduit.Internal -- | The underlying datatype for all the types in this package. In has four -- type parameters: -- -- -- -- Note that o and r are inherently different. o is -- the type of the stream of values this Pipe will produce and -- send downstream. r is the final output of this Pipe. -- -- Pipes can be composed via the pipe function. To do so, -- the output type of the left pipe much match the input type of the left -- pipe, and the result type of the left pipe must be unit (). -- This is due to the fact that any result produced by the left pipe must -- be discarded in favor of the result of the right pipe. -- -- Since 0.4.0 data Pipe i o m r -- | Provide new output to be sent downstream. This constructor has three -- fields: the next Pipe to be used, an early-closed function, -- and the output value. HaveOutput :: (Pipe i o m r) -> (Finalize m r) -> o -> Pipe i o m r -- | Request more input from upstream. The first field takes a new input -- value and provides a new Pipe. The second is for early -- termination. It gives a new Pipe which takes no input from -- upstream. This allows a Pipe to provide a final stream of -- output values after no more input is available from upstream. NeedInput :: (i -> Pipe i o m r) -> (Pipe i o m r) -> Pipe i o m r -- | Processing with this Pipe is complete. Provides an optional -- leftover input value and and result. Done :: (Maybe i) -> r -> Pipe i o m r -- | Require running of a monadic action to get the next Pipe. -- Second field is an early cleanup function. Technically, this second -- field could be skipped, but doing so would require extra operations to -- be performed in some cases. For example, for a Pipe pulling -- data from a file, it may be forced to pull an extra, unneeded chunk -- before closing the Handle. PipeM :: (m (Pipe i o m r)) -> (Finalize m r) -> Pipe i o m r -- | A Pipe which provides a stream of output values, without -- consuming any input. The input parameter is set to Void to -- indicate that this Pipe takes no input. A Source is -- not used to produce a final result, and thus the result parameter is -- set to (). -- -- Since 0.4.0 type Source m a = Pipe Void a m () -- | A Pipe which consumes a stream of input values and produces a -- final result. It cannot produce any output values, and thus the output -- parameter is set to Void. In other words, it is impossible to -- create a HaveOutput constructor for a Sink. -- -- Since 0.4.0 type Sink i m r = Pipe i Void m r -- | A Pipe which consumes a stream of input values and produces a -- stream of output values. It does not produce a result value, and thus -- the result parameter is set to (). -- -- Since 0.4.0 type Conduit i m o = Pipe i o m () -- | A cleanup action to be performed. -- -- Previously, we just had a plain action. However, most Pipes -- simply have empty cleanup actions, and storing a large set of them -- wastes memory. But having strict fields and distinguishing between -- pure and impure actions, we can keep memory usage constant, and only -- allocate memory for the actual actions we have to track. -- -- Since 0.4.1 data Finalize m r FinalizePure :: r -> Finalize m r FinalizeM :: (m r) -> Finalize m r -- | Perform any close actions available for the given Pipe. -- -- Since 0.4.0 pipeClose :: Monad m => Pipe i o m r -> Finalize m r -- | Compose a left and right pipe together into a complete pipe. The left -- pipe will be automatically closed when the right pipe finishes, and -- any leftovers from the right pipe will be discarded. -- -- This is in fact a wrapper around pipeResume. This function -- closes the left Pipe returns by pipeResume and -- returns only the result. -- -- Since 0.4.0 pipe :: Monad m => Pipe a b m () -> Pipe b c m r -> Pipe a c m r -- | Same as pipe, but retain both the new left pipe and the -- leftovers from the right pipe. The two components are combined -- together into a single pipe and returned, together with the result of -- the right pipe. -- -- Note: we're biased towards checking the right side first to avoid -- pulling extra data which is not needed. Doing so could cause data -- loss. -- -- Since 0.4.0 pipeResume :: Monad m => Pipe a b m () -> Pipe b c m r -> Pipe a c m (Pipe a b m (), r) -- | Run a complete pipeline until processing completes. -- -- Since 0.4.0 runPipe :: Monad m => Pipe Void Void m r -> m r -- | A Sink has a Void type parameter for the output, -- which makes it difficult to compose with Sources and -- Conduits. This function replaces that parameter with a free -- variable. This function is essentially id; it only modifies -- the types, not the actions performed. -- -- Since 0.4.0 sinkToPipe :: Monad m => Sink i m r -> Pipe i o m r -- | Wait for a single input value from upstream, and remove it from the -- stream. Returns Nothing if no more data is available. -- -- Since 0.4.0 await :: Pipe i o m (Maybe i) -- | Send a single output value downstream. -- -- Since 0.4.0 yield :: Monad m => o -> Pipe i o m () -- | Check if input is available from upstream. Will not remove the data -- from the stream. -- -- Since 0.4.0 hasInput :: Pipe i o m Bool -- | Transform the monad that a Pipe lives in. -- -- Since 0.4.0 transPipe :: Monad m => (forall a. m a -> n a) -> Pipe i o m r -> Pipe i o n r -- | Apply a function to all the output values of a Pipe. -- -- This mimics the behavior of fmap for a Source and -- Conduit in pre-0.4 days. -- -- Since 0.4.1 mapOutput :: Monad m => (o1 -> o2) -> Pipe i o1 m r -> Pipe i o2 m r -- | Perform any necessary finalization actions. -- -- Since 0.4.1 runFinalize :: Monad m => Finalize m r -> m r -- | Add some code to be run when the given Pipe cleans up. -- -- Since 0.4.1 addCleanup :: Monad m => (Bool -> m ()) -> Pipe i o m r -> Pipe i o m r instance Monad m => Monoid (Pipe i o m ()) instance MonadIO m => MonadIO (Pipe i o m) instance MonadTrans (Pipe i o) instance MonadBase base m => MonadBase base (Pipe i o m) instance Monad m => Monad (Pipe i o m) instance Monad m => Applicative (Pipe i o m) instance Monad m => Functor (Pipe i o m) instance MonadResource m => MonadResource (Finalize m) instance MonadIO m => MonadIO (Finalize m) instance MonadThrow m => MonadThrow (Finalize m) instance MonadTrans Finalize instance Monad m => Monad (Finalize m) instance Monad m => Applicative (Finalize m) instance Monad m => Functor (Finalize m) -- | The main module, exporting types, utility functions, and fuse and -- connect operators. -- -- There are three main types in this package: Source (data -- producer), Sink (data consumer), and Conduit (data -- transformer). All three are in fact type synonyms for the underlying -- Pipe data type. -- -- The typical approach to use of this package is: -- -- module Data.Conduit -- | The underlying datatype for all the types in this package. In has four -- type parameters: -- -- -- -- Note that o and r are inherently different. o is -- the type of the stream of values this Pipe will produce and -- send downstream. r is the final output of this Pipe. -- -- Pipes can be composed via the pipe function. To do so, -- the output type of the left pipe much match the input type of the left -- pipe, and the result type of the left pipe must be unit (). -- This is due to the fact that any result produced by the left pipe must -- be discarded in favor of the result of the right pipe. -- -- Since 0.4.0 data Pipe i o m r -- | Provide new output to be sent downstream. This constructor has three -- fields: the next Pipe to be used, an early-closed function, -- and the output value. HaveOutput :: (Pipe i o m r) -> (Finalize m r) -> o -> Pipe i o m r -- | Request more input from upstream. The first field takes a new input -- value and provides a new Pipe. The second is for early -- termination. It gives a new Pipe which takes no input from -- upstream. This allows a Pipe to provide a final stream of -- output values after no more input is available from upstream. NeedInput :: (i -> Pipe i o m r) -> (Pipe i o m r) -> Pipe i o m r -- | Processing with this Pipe is complete. Provides an optional -- leftover input value and and result. Done :: (Maybe i) -> r -> Pipe i o m r -- | Require running of a monadic action to get the next Pipe. -- Second field is an early cleanup function. Technically, this second -- field could be skipped, but doing so would require extra operations to -- be performed in some cases. For example, for a Pipe pulling -- data from a file, it may be forced to pull an extra, unneeded chunk -- before closing the Handle. PipeM :: (m (Pipe i o m r)) -> (Finalize m r) -> Pipe i o m r -- | A Pipe which provides a stream of output values, without -- consuming any input. The input parameter is set to Void to -- indicate that this Pipe takes no input. A Source is -- not used to produce a final result, and thus the result parameter is -- set to (). -- -- Since 0.4.0 type Source m a = Pipe Void a m () -- | A Pipe which consumes a stream of input values and produces a -- stream of output values. It does not produce a result value, and thus -- the result parameter is set to (). -- -- Since 0.4.0 type Conduit i m o = Pipe i o m () -- | A Pipe which consumes a stream of input values and produces a -- final result. It cannot produce any output values, and thus the output -- parameter is set to Void. In other words, it is impossible to -- create a HaveOutput constructor for a Sink. -- -- Since 0.4.0 type Sink i m r = Pipe i Void m r -- | The connect operator, which pulls data from a source and pushes to a -- sink. There are two ways this process can terminate: -- --
    --
  1. If the Sink is a Done constructor, the -- Source is closed.
  2. --
  3. If the Source is a Done constructor, the -- Sink is closed.
  4. --
-- -- In other words, both the Source and Sink will always -- be closed. If you would like to keep the Source open to be -- used for another operations, use the connect-and-resume operators -- $$+. -- -- Since 0.4.0 ($$) :: Monad m => Source m a -> Sink a m b -> m b -- | The connect-and-resume operator. Does not close the Source, -- but instead returns it to be used again. This allows a Source -- to be used incrementally in a large program, without forcing the -- entire program to live in the Sink monad. -- -- Mnemonic: connect + do more. -- -- Since 0.4.0 ($$+) :: Monad m => Source m a -> Sink a m b -> m (Source m a, b) -- | Left fuse, combining a source and a conduit together into a new -- source. -- -- Both the Source and Conduit will be closed when the -- newly-created Source is closed. -- -- Leftover data from the Conduit will be discarded. -- -- Since 0.4.0 ($=) :: Monad m => Source m a -> Conduit a m b -> Source m b -- | Right fuse, combining a conduit and a sink together into a new sink. -- -- Both the Conduit and Sink will be closed when the -- newly-created Sink is closed. -- -- Leftover data returned from the Sink will be discarded. -- -- Since 0.4.0 (=$) :: Monad m => Conduit a m b -> Sink b m c -> Sink a m c -- | Fusion operator, combining two Pipes together into a new -- Pipe. -- -- Both Pipes will be closed when the newly-created -- Pipe is closed. -- -- Leftover data returned from the right Pipe will be discarded. -- -- Note: in previous versions, this operator would only fuse together two -- Conduits (known as middle fusion). This operator is -- generalized to work on all Pipes, including Sources -- and Sinks. -- -- Since 0.4.0 (=$=) :: Monad m => Pipe a b m () -> Pipe b c m r -> Pipe a c m r -- | Wait for a single input value from upstream, and remove it from the -- stream. Returns Nothing if no more data is available. -- -- Since 0.4.0 await :: Pipe i o m (Maybe i) -- | Send a single output value downstream. -- -- Since 0.4.0 yield :: Monad m => o -> Pipe i o m () -- | Check if input is available from upstream. Will not remove the data -- from the stream. -- -- Since 0.4.0 hasInput :: Pipe i o m Bool -- | Transform the monad that a Pipe lives in. -- -- Since 0.4.0 transPipe :: Monad m => (forall a. m a -> n a) -> Pipe i o m r -> Pipe i o n r -- | Apply a function to all the output values of a Pipe. -- -- This mimics the behavior of fmap for a Source and -- Conduit in pre-0.4 days. -- -- Since 0.4.1 mapOutput :: Monad m => (o1 -> o2) -> Pipe i o1 m r -> Pipe i o2 m r -- | Construct a Source with some stateful functions. This function -- addresses threading the state value for you. -- -- Since 0.3.0 sourceState :: Monad m => state -> (state -> m (SourceStateResult state output)) -> Source m output -- | A combination of sourceIO and sourceState. -- -- Since 0.3.0 sourceStateIO :: MonadResource m => IO state -> (state -> IO ()) -> (state -> m (SourceStateResult state output)) -> Source m output -- | The return value when pulling in the sourceState function. -- Either indicates no more data, or the next value and an updated state. -- -- Since 0.3.0 data SourceStateResult state output StateOpen :: state -> output -> SourceStateResult state output StateClosed :: SourceStateResult state output -- | Construct a Source based on some IO actions for alloc/release. -- -- Since 0.3.0 sourceIO :: MonadResource m => IO state -> (state -> IO ()) -> (state -> m (SourceIOResult output)) -> Source m output -- | The return value when pulling in the sourceIO function. -- Either indicates no more data, or the next value. -- -- Since 0.3.0 data SourceIOResult output IOOpen :: output -> SourceIOResult output IOClosed :: SourceIOResult output -- | Construct a Sink with some stateful functions. This function -- addresses threading the state value for you. -- -- Since 0.3.0 sinkState :: Monad m => state -> (state -> input -> m (SinkStateResult state input output)) -> (state -> m output) -> Sink input m output -- | A helper type for sinkState, indicating the result of being -- pushed to. It can either indicate that processing is done, or to -- continue with the updated state. -- -- Since 0.3.0 data SinkStateResult state input output StateDone :: (Maybe input) -> output -> SinkStateResult state input output StateProcessing :: state -> SinkStateResult state input output -- | Construct a Sink. Note that your push and close functions need -- not explicitly perform any cleanup. -- -- Since 0.3.0 sinkIO :: MonadResource m => IO state -> (state -> IO ()) -> (state -> input -> m (SinkIOResult input output)) -> (state -> m output) -> Sink input m output -- | A helper type for sinkIO, indicating the result of being -- pushed to. It can either indicate that processing is done, or to -- continue. -- -- Since 0.3.0 data SinkIOResult input output IODone :: (Maybe input) -> output -> SinkIOResult input output IOProcessing :: SinkIOResult input output -- | A helper function for returning a list of values from a -- Conduit. -- -- Since 0.3.0 haveMore :: Conduit a m b -> m () -> [b] -> Conduit a m b -- | Construct a Conduit with some stateful functions. This function -- addresses threading the state value for you. -- -- Since 0.3.0 conduitState :: Monad m => state -> (state -> input -> m (ConduitStateResult state input output)) -> (state -> m [output]) -> Conduit input m output -- | A helper type for conduitState, indicating the result of -- being pushed to. It can either indicate that processing is done, or to -- continue with the updated state. -- -- Since 0.3.0 data ConduitStateResult state input output StateFinished :: (Maybe input) -> [output] -> ConduitStateResult state input output StateProducing :: state -> [output] -> ConduitStateResult state input output -- | Construct a Conduit. -- -- Since 0.3.0 conduitIO :: MonadResource m => IO state -> (state -> IO ()) -> (state -> input -> m (ConduitIOResult input output)) -> (state -> m [output]) -> Conduit input m output -- | A helper type for conduitIO, indicating the result of being -- pushed to. It can either indicate that processing is done, or to -- continue. -- -- Since 0.3.0 data ConduitIOResult input output IOFinished :: (Maybe input) -> [output] -> ConduitIOResult input output IOProducing :: [output] -> ConduitIOResult input output -- | Helper type for constructing a Conduit based on -- Sinks. This allows you to write higher-level code that takes -- advantage of existing conduits and sinks, and leverages a sink's -- monadic interface. -- -- Since 0.3.0 type SequencedSink state input m output = state -> Sink input m (SequencedSinkResponse state input m output) -- | Convert a SequencedSink into a Conduit. -- -- Since 0.3.0 sequenceSink :: Monad m => state -> SequencedSink state input m output -> Conduit input m output -- | Specialised version of sequenceSink -- -- Note that this function will return an infinite stream if provided a -- Sink which does not consume data. In other words, you -- probably don't want to do sequence . return. -- -- Since 0.3.0 sequence :: Monad m => Sink input m output -> Conduit input m output -- | Return value from a SequencedSink. -- -- Since 0.3.0 data SequencedSinkResponse state input m output -- | Set a new state, and emit some new output. Emit :: state -> [output] -> SequencedSinkResponse state input m output -- | End the conduit. Stop :: SequencedSinkResponse state input m output -- | Pass control to a new conduit. StartConduit :: (Conduit input m output) -> SequencedSinkResponse state input m output -- | Provide for a stream of data that can be flushed. -- -- A number of Conduits (e.g., zlib compression) need the -- ability to flush the stream at some point. This provides a single -- wrapper datatype to be used in all such circumstances. -- -- Since 0.3.0 data Flush a Chunk :: a -> Flush a Flush :: Flush a -- | The Resource transformer. This transformer keeps track of all -- registered actions, and calls them upon exit (via -- runResourceT). Actions may be registered via register, -- or resources may be allocated atomically via allocate. -- allocate corresponds closely to bracket. -- -- Releasing may be performed before exit via the release -- function. This is a highly recommended optimization, as it will ensure -- that scarce resources are freed early. Note that calling -- release will deregister the action, so that a release action -- will only ever be called once. -- -- Since 0.3.0 data ResourceT (m :: * -> *) a :: (* -> *) -> * -> * -- | A Monad which allows for safe resource allocation. In theory, -- any monad transformer stack included a ResourceT can be an -- instance of MonadResource. -- -- Note: runResourceT has a requirement for a -- MonadBaseControl IO m monad, which allows control operations -- to be lifted. A MonadResource does not have this requirement. -- This means that transformers such as ContT can be an instance -- of MonadResource. However, the ContT wrapper will -- need to be unwrapped before calling runResourceT. -- -- Since 0.3.0 class (MonadThrow m, MonadUnsafeIO m, MonadIO m, Applicative m) => MonadResource (m :: * -> *) -- | A Monad which can throw exceptions. Note that this does not -- work in a vanilla ST or Identity monad. Instead, you -- should use the ExceptionT transformer in your stack if you are -- dealing with a non-IO base monad. -- -- Since 0.3.0 class Monad m => MonadThrow (m :: * -> *) monadThrow :: (MonadThrow m, Exception e) => e -> m a -- | A Monad based on some monad which allows running of some -- IO actions, via unsafe calls. This applies to IO and -- ST, for instance. -- -- Since 0.3.0 class Monad m => MonadUnsafeIO (m :: * -> *) unsafeLiftIO :: MonadUnsafeIO m => IO a -> m a -- | Unwrap a ResourceT transformer, and call all registered release -- actions. -- -- Note that there is some reference counting involved due to -- resourceForkIO. If multiple threads are sharing the same -- collection of resources, only the last call to runResourceT -- will deallocate the resources. -- -- Since 0.3.0 runResourceT :: MonadBaseControl IO m => ResourceT m a -> m a instance Show a => Show (Flush a) instance Eq a => Eq (Flush a) instance Ord a => Ord (Flush a) instance Functor Flush -- | Functions for interacting with bytes. module Data.Conduit.Binary -- | Stream the contents of a file as binary data. -- -- Since 0.3.0 sourceFile :: MonadResource m => FilePath -> Source m ByteString -- | Stream the contents of a Handle as binary data. Note that this -- function will not automatically close the Handle when -- processing completes, since it did not acquire the Handle in -- the first place. -- -- Since 0.3.0 sourceHandle :: MonadIO m => Handle -> Source m ByteString -- | An alternative to sourceHandle. Instead of taking a pre-opened -- Handle, it takes an action that opens a Handle (in read -- mode), so that it can open it only when needed and close it as soon as -- possible. -- -- Since 0.3.0 sourceIOHandle :: MonadResource m => IO Handle -> Source m ByteString -- | Stream the contents of a file as binary data, starting from a certain -- offset and only consuming up to a certain number of bytes. -- -- Since 0.3.0 sourceFileRange :: MonadResource m => FilePath -> Maybe Integer -> Maybe Integer -> Source m ByteString -- | Stream all incoming data to the given file. -- -- Since 0.3.0 sinkFile :: MonadResource m => FilePath -> Sink ByteString m () -- | Stream all incoming data to the given Handle. Note that this -- function will not automatically close the Handle when -- processing completes. -- -- Since 0.3.0 sinkHandle :: MonadIO m => Handle -> Sink ByteString m () -- | An alternative to sinkHandle. Instead of taking a pre-opened -- Handle, it takes an action that opens a Handle (in write -- mode), so that it can open it only when needed and close it as soon as -- possible. -- -- Since 0.3.0 sinkIOHandle :: MonadResource m => IO Handle -> Sink ByteString m () -- | Stream the contents of the input to a file, and also send it along the -- pipeline. Similar in concept to the Unix command tee. -- -- Since 0.3.0 conduitFile :: MonadResource m => FilePath -> Conduit ByteString m ByteString -- | Ensure that only up to the given number of bytes are consume by the -- inner sink. Note that this does not ensure that all of those -- bytes are in fact consumed. -- -- Since 0.3.0 isolate :: Monad m => Int -> Conduit ByteString m ByteString -- | Open a file Handle safely by automatically registering a -- release action. -- -- While you are not required to call hClose on the resulting -- handle, you should do so as early as possible to free scarce -- resources. -- -- Since 0.3.0 openFile :: MonadResource m => FilePath -> IOMode -> m Handle -- | Return the next byte from the stream, if available. -- -- Since 0.3.0 head :: Monad m => Sink ByteString m (Maybe Word8) -- | Return all bytes while the predicate returns True. -- -- Since 0.3.0 takeWhile :: Monad m => (Word8 -> Bool) -> Conduit ByteString m ByteString -- | Ignore all bytes while the predicate returns True. -- -- Since 0.3.0 dropWhile :: Monad m => (Word8 -> Bool) -> Sink ByteString m () -- | Take the given number of bytes, if available. -- -- Since 0.3.0 take :: Monad m => Int -> Sink ByteString m ByteString -- | Split the input bytes into lines. In other words, split on the LF byte -- (10), and strip it from the output. -- -- Since 0.3.0 lines :: Monad m => Conduit ByteString m ByteString -- | Higher-level functions to interact with the elements of a stream. Most -- of these are based on list functions. -- -- Note that these functions all deal with individual elements of a -- stream as a sort of "black box", where there is no introspection of -- the contained elements. Values such as ByteString and -- Text will likely need to be treated specially to deal with -- their contents properly (Word8 and Char, -- respectively). See the Data.Conduit.Binary and -- Data.Conduit.Text modules. module Data.Conduit.List -- | Convert a list into a source. -- -- Since 0.3.0 sourceList :: Monad m => [a] -> Source m a -- | A source that returns nothing. Note that this is just a -- type-restricted synonym for mempty. -- -- Since 0.3.0 sourceNull :: Monad m => Source m a -- | Generate a source from a seed value. -- -- Since 0.4.2 unfold :: Monad m => (b -> Maybe (a, b)) -> b -> Source m a -- | Enumerate from a value to a final value, inclusive, via succ. -- -- This is generally more efficient than using Prelude's -- enumFromTo and combining with sourceList since this -- avoids any intermediate data structures. -- -- Since 0.4.2 enumFromTo :: (Enum a, Eq a, Monad m) => a -> a -> Source m a -- | A strict left fold. -- -- Since 0.3.0 fold :: Monad m => (b -> a -> b) -> b -> Sink a m b -- | Take some values from the stream and return as a list. If you want to -- instead create a conduit that pipes data to another sink, see -- isolate. This function is semantically equivalent to: -- --
--   take i = isolate i =$ consume
--   
-- -- Since 0.3.0 take :: Monad m => Int -> Sink a m [a] -- | Ignore a certain number of values in the stream. This function is -- semantically equivalent to: -- --
--   drop i = take i >> return ()
--   
-- -- However, drop is more efficient as it does not need to hold -- values in memory. -- -- Since 0.3.0 drop :: Monad m => Int -> Sink a m () -- | Take a single value from the stream, if available. -- -- Since 0.3.0 head :: Monad m => Sink a m (Maybe a) -- | Combines two sources. The new source will stop producing once either -- source has been exhausted. -- -- Since 0.3.0 zip :: Monad m => Source m a -> Source m b -> Source m (a, b) -- | Combines two sinks. The new sink will complete when both input sinks -- have completed. -- -- If both sinks finish on the same chunk, and both report leftover -- input, arbitrarily yield the left sink's leftover input. -- -- Since 0.4.1 zipSinks :: Monad m => Sink i m r -> Sink i m r' -> Sink i m (r, r') -- | Look at the next value in the stream, if available. This function will -- not change the state of the stream. -- -- Since 0.3.0 peek :: Monad m => Sink a m (Maybe a) -- | Consume all values from the stream and return as a list. Note that -- this will pull all values into memory. For a lazy variant, see -- Data.Conduit.Lazy. -- -- Since 0.3.0 consume :: Monad m => Sink a m [a] -- | Ignore the remainder of values in the source. Particularly useful when -- combined with isolate. -- -- Since 0.3.0 sinkNull :: Monad m => Sink a m () -- | A monadic strict left fold. -- -- Since 0.3.0 foldM :: Monad m => (b -> a -> m b) -> b -> Sink a m b -- | Apply the action to all values in the stream. -- -- Since 0.3.0 mapM_ :: Monad m => (a -> m ()) -> Sink a m () -- | Apply a transformation to all values in a stream. -- -- Since 0.3.0 map :: Monad m => (a -> b) -> Conduit a m b -- | Apply a transformation to all values in a stream, concatenating the -- output values. -- -- Since 0.3.0 concatMap :: Monad m => (a -> [b]) -> Conduit a m b -- | concatMap with an accumulator. -- -- Since 0.3.0 concatMapAccum :: Monad m => (a -> accum -> (accum, [b])) -> accum -> Conduit a m b -- | Grouping input according to an equality function. -- -- Since 0.3.0 groupBy :: Monad m => (a -> a -> Bool) -> Conduit a m [a] -- | Ensure that the inner sink consumes no more than the given number of -- values. Note this this does not ensure that the sink consumes -- all of those values. To get the latter behavior, combine with -- sinkNull, e.g.: -- --
--   src $$ do
--       x <- isolate count =$ do
--           x <- someSink
--           sinkNull
--           return x
--       someOtherSink
--       ...
--   
-- -- Since 0.3.0 isolate :: Monad m => Int -> Conduit a m a -- | Keep only values in the stream passing a given predicate. -- -- Since 0.3.0 filter :: Monad m => (a -> Bool) -> Conduit a m a -- | Apply a monadic transformation to all values in a stream. -- -- If you do not need the transformed values, and instead just want the -- monadic side-effects of running the action, see mapM_. -- -- Since 0.3.0 mapM :: Monad m => (a -> m b) -> Conduit a m b -- | Apply a monadic transformation to all values in a stream, -- concatenating the output values. -- -- Since 0.3.0 concatMapM :: Monad m => (a -> m [b]) -> Conduit a m b -- | concatMapM with an accumulator. -- -- Since 0.3.0 concatMapAccumM :: Monad m => (a -> accum -> m (accum, [b])) -> accum -> Conduit a m b -- | Handle streams of text. -- -- Parts of this code were taken from enumerator and adapted for -- conduits. module Data.Conduit.Text -- | A specific character encoding. -- -- Since 0.3.0 data Codec -- | Convert text into bytes, using the provided codec. If the codec is not -- capable of representing an input character, an exception will be -- thrown. -- -- Since 0.3.0 encode :: MonadThrow m => Codec -> Conduit Text m ByteString -- | Convert bytes into text, using the provided codec. If the codec is not -- capable of decoding an input byte sequence, an exception will be -- thrown. -- -- Since 0.3.0 decode :: MonadThrow m => Codec -> Conduit ByteString m Text -- | Since 0.3.0 utf8 :: Codec -- | Since 0.3.0 utf16_le :: Codec -- | Since 0.3.0 utf16_be :: Codec -- | Since 0.3.0 utf32_le :: Codec -- | Since 0.3.0 utf32_be :: Codec -- | Since 0.3.0 ascii :: Codec -- | Since 0.3.0 iso8859_1 :: Codec -- | Emit each line separately -- -- Since 0.4.1 lines :: Monad m => Conduit Text m Text instance Typeable TextException instance Show TextException instance Exception TextException instance Show Codec -- | Use lazy I/O for consuming the contents of a source. Warning: All -- normal warnings of lazy I/O apply. However, if you consume the content -- within the ResourceT, you should be safe. module Data.Conduit.Lazy -- | Use lazy I/O to consume all elements from a Source. -- -- This function relies on monadActive to determine if the -- underlying monadic state has been closed. -- -- Since 0.3.0 lazyConsume :: (MonadBaseControl IO m, MonadActive m) => Source m a -> m [a]