\onecolumn \section{Haddock API documentation} This section just repeats literate documentation in Haddock syntax. :d Data.Enumerator module header ----------------------------------------------------------------------------- -- | -- Module: Data.Enumerator -- Copyright: 2010 John Millikin -- License: MIT -- -- Maintainer: jmillikin@gmail.com -- Portability: portable -- -- Core enumerator types, and some useful primitives. -- -- This module is intended to be imported qualified: -- -- @ -- import qualified Data.Enumerator as E -- @ -- ----------------------------------------------------------------------------- : :d Data.Enumerator.List module header ----------------------------------------------------------------------------- -- | -- Module: Data.Enumerator.List -- Copyright: 2010 John Millikin -- License: MIT -- -- Maintainer: jmillikin@gmail.com -- Portability: portable -- -- This module is intended to be imported qualified: -- -- @ -- import qualified Data.Enumerator.List as EL -- @ -- -- Since: 0.4.5 -- ----------------------------------------------------------------------------- : :d Data.Enumerator.Binary module header ----------------------------------------------------------------------------- -- | -- Module: Data.Enumerator.Binary -- Copyright: 2010 John Millikin -- License: MIT -- -- Maintainer: jmillikin@gmail.com -- Portability: portable -- -- Byte-oriented alternatives to "Data.Enumerator.List". Note that the -- enumeratees in this module must unpack their inputs to work properly. If -- you do not need to handle leftover input on a byte-by-byte basis, the -- chunk-oriented versions will be much faster. -- -- This module is intended to be imported qualified: -- -- @ -- import qualified Data.Enumerator.Binary as EB -- @ -- -- Since: 0.4.5 -- ----------------------------------------------------------------------------- : :d Data.Enumerator.Text module header ----------------------------------------------------------------------------- -- | -- Module: Data.Enumerator.Text -- Copyright: 2010 John Millikin -- License: MIT -- -- Maintainer: jmillikin@gmail.com -- Portability: portable -- -- Character-oriented alternatives to "Data.Enumerator.List". Note that the -- enumeratees in this module must unpack their inputs to work properly. If -- you do not need to handle leftover input on a char-by-char basis, the -- chunk-oriented versions will be much faster. -- -- This module is intended to be imported qualified: -- -- @ -- import qualified Data.Enumerator.Text as ET -- @ -- -- Since: 0.2 -- ----------------------------------------------------------------------------- : :d Data.Enumerator.IO module header ----------------------------------------------------------------------------- -- | -- Module: Data.Enumerator.IO -- Copyright: 2010 John Millikin -- License: MIT -- -- Maintainer: jmillikin@gmail.com -- Portability: portable -- -- Deprecated in 0.4.5: use "Data.Enumerator.Binary" instead -- ----------------------------------------------------------------------------- : :d apidoc Data.Enumerator.($$) -- | @'($$)' = '(==\<\<)'@ -- -- This might be easier to read when passing a chain of iteratees to an -- enumerator. -- -- Since: 0.1.1 : :d apidoc Data.Enumerator.($=) -- | @enum $= enee = 'joinE' enum enee@ -- -- “Wraps” an enumerator /inner/ in an enumeratee /wrapper/. -- The resulting enumerator will generate /wrapper/’s output type. -- -- As an example, consider an enumerator that yields line character counts -- for a text file (e.g. for source code readability checking): -- -- > enumFileCounts :: FilePath -> Enumerator Int IO b -- -- It could be written with either 'joinE' or '($=)': -- -- > import Data.Text as T -- > import Data.Enumerator.List as EL -- > import Data.Enumerator.Text as ET -- > -- > enumFileCounts path = joinE (enumFile path) (EL.map T.length) -- > enumFileCounts path = enumFile path $= EL.map T.length -- -- Since: 0.4.9 : :d apidoc Data.Enumerator.(=$) -- | @enum =$ iter = 'joinI' (enum $$ iter)@ -- -- “Wraps” an iteratee /inner/ in an enumeratee /wrapper/. -- The resulting iteratee will consume /wrapper/’s input type and -- yield /inner/’s output type. -- -- Note: if the inner iteratee yields leftover input when it finishes, -- that extra will be discarded. -- -- As an example, consider an iteratee that converts a stream of UTF8-encoded -- bytes into a single 'TL.Text': -- -- > consumeUTF8 :: Monad m => Iteratee ByteString m Text -- -- It could be written with either 'joinI' or '(=$)': -- -- > import Data.Enumerator.Text as ET -- > -- > consumeUTF8 = joinI (decode utf8 $$ ET.consume) -- > consumeUTF8 = decode utf8 =$ ET.consume -- -- Since: 0.4.9 : :d apidoc Data.Enumerator.(<==<) -- | @'(\<==\<)' = flip '(>==>)'@ -- -- Since: 0.1.1 : :d apidoc Data.Enumerator.(==<<) -- | @'(==\<\<)' = flip '(\>\>==)'@ : :d apidoc Data.Enumerator.(>==>) -- | @'(>==>)' e1 e2 s = e1 s '>>==' e2@ -- -- Since: 0.1.1 : :d apidoc Data.Enumerator.(>>==) -- | Equivalent to '(>>=)' for @m ('Step' a m b)@; allows 'Iteratee's with -- different input types to be composed. : :d apidoc Data.Enumerator.Continue -- | The 'Iteratee' is capable of accepting more input. Note that more input -- is not necessarily required; the 'Iteratee' might be able to generate a -- value immediately if it receives 'EOF'. : :d apidoc Data.Enumerator.Enumeratee -- | In cases where an enumerator acts as both a source and sink, the resulting -- type is named an 'Enumeratee'. Enumeratees have two input types, -- “outer a” (@aOut@) and “inner a” (@aIn@). : :d apidoc Data.Enumerator.Enumerator -- | While 'Iteratee's consume data, enumerators generate it. Since -- @'Iteratee'@ is an alias for @m ('Step' a m b)@, 'Enumerator's can -- be considered step transformers of type -- @'Step' a m b -> m ('Step' a m b)@. -- -- 'Enumerator's typically read from an external source (parser, handle, -- random generator, etc). They feed chunks into an 'Iteratee' until the -- source runs out of data (triggering 'EOF') or the iteratee finishes -- processing ('Yield's a value). : :d apidoc Data.Enumerator.Error -- | The 'Iteratee' encountered an error which prevents it from proceeding -- further. : :d apidoc Data.Enumerator.Iteratee -- | The primary data type for this library, which consumes -- input from a 'Stream' until it either generates a value or encounters -- an error. Rather than requiring all input at once, an iteratee will -- return 'Continue' when it is capable of processing more data. -- -- In general, iteratees begin in the 'Continue' state. As each chunk is -- passed to the continuation, the iteratee returns the next step: -- 'Continue' for more data, 'Yield' when it's finished, or 'Error' to -- abort processing. : :d apidoc Data.Enumerator.Stream -- | A 'Stream' is a sequence of chunks generated by an 'Enumerator'. -- -- @('Chunks' [])@ is used to indicate that a stream is still active, but -- currently has no available data. Iteratees should ignore empty chunks. : :d apidoc Data.Enumerator.Yield -- | The 'Iteratee' cannot receive any more input, and has generated a -- result. Included in this value is left-over input, which can be passed to -- composed 'Iteratee's. : :d apidoc Data.Enumerator.break -- | Deprecated in 0.4.5: use 'Data.Enumerator.List.takeWhile' instead : :d apidoc Data.Enumerator.catchError -- | Runs the iteratee, and calls an exception handler if an 'Error' is -- returned. By handling errors within the enumerator library, and requiring -- all errors to be represented by 'Exc.SomeException', libraries with -- varying error types can be easily composed. -- -- Since: 0.1.1 : :d apidoc Data.Enumerator.checkContinue0 -- | A common pattern in 'Enumerator' implementations is to check whether -- the inner 'Iteratee' has finished, and if so, to return its output. -- 'checkContinue0' passes its parameter a continuation if the 'Iteratee' -- can still consume input; if not, it returns the iteratee's step. -- -- The type signature here is a bit crazy, but it's actually very easy to -- use. Take this code: -- -- > repeat :: Monad m => a -> Enumerator a m b -- > repeat x = loop where -- > loop (Continue k) = k (Chunks [x]) >>== loop -- > loop step = returnI step -- -- And rewrite it without the boilerplate: -- -- > repeat :: Monad m => a -> Enumerator a m b -- > repeat x = checkContinue0 $ \loop k -> k (Chunks [x] >>== loop -- -- Since: 0.4.9 : :d apidoc Data.Enumerator.checkContinue1 -- | Like 'checkContinue0', but allows each loop step to use a state value: -- -- > iterate :: Monad m => (a -> a) -> a -> Enumerator a m b -- > iterate f = checkContinue1 $ \loop a k -> k (Chunks [a]) >>== loop (f a) -- -- Since: 0.4.9 : :d apidoc Data.Enumerator.checkDone -- | @'checkDone' = 'checkDoneEx' ('Chunks' [])@ -- -- Use this for enumeratees which do not have an input buffer. : :d apidoc Data.Enumerator.checkDoneEx -- | A common pattern in 'Enumeratee' implementations is to check whether -- the inner 'Iteratee' has finished, and if so, to return its output. -- 'checkDone' passes its parameter a continuation if the 'Iteratee' -- can still consume input, or yields otherwise. -- -- Since: 0.4.3 : :d apidoc Data.Enumerator.concatEnums -- | Compose a list of 'Enumerator's using @'(>>==)'@ : :d apidoc Data.Enumerator.concatMap -- | Deprecated in 0.4.8: use 'Data.Enumerator.List.concatMap' instead -- -- Since: 0.4.3 : :d apidoc Data.Enumerator.concatMapM -- | Deprecated in 0.4.8: use 'Data.Enumerator.List.concatMapM' instead -- -- Since: 0.4.5 : :d apidoc Data.Enumerator.consume -- | Deprecated in 0.4.5: use 'Data.Enumerator.List.consume' instead : :d apidoc Data.Enumerator.continue -- | @'continue' k = 'returnI' ('Continue' k)@ : :d apidoc Data.Enumerator.drop -- | Deprecated in 0.4.5: use 'Data.Enumerator.List.drop' instead : :d apidoc Data.Enumerator.dropWhile -- | Deprecated in 0.4.5: use 'Data.Enumerator.List.dropWhile' instead : :d apidoc Data.Enumerator.enumEOF -- | Sends 'EOF' to its iteratee. Most clients should use 'run' or 'run_' -- instead. : :d apidoc Data.Enumerator.enumList -- | @'enumList' n xs@ enumerates /xs/ as a stream, passing /n/ inputs per -- chunk. -- -- Primarily useful for testing and debugging. : :d apidoc Data.Enumerator.filter -- | Deprecated in 0.4.8: use 'Data.Enumerator.List.filter' instead -- -- Since: 0.4.5 : :d apidoc Data.Enumerator.filterM -- | Deprecated in 0.4.8: use 'Data.Enumerator.List.filterM' instead -- -- Since: 0.4.5 : :d apidoc Data.Enumerator.foldl -- | Deprecated in 0.4.8: use 'Data.Enumerator.List.fold' instead -- -- Since: 0.4.5 : :d apidoc Data.Enumerator.foldl' -- | Deprecated in 0.4.8: use 'Data.Enumerator.List.fold' instead -- -- Since: 0.4.5 : :d apidoc Data.Enumerator.foldM -- | Deprecated in 0.4.8: use 'Data.Enumerator.List.foldM' instead -- -- Since: 0.4.5 : :d apidoc Data.Enumerator.generateM -- | Deprecated in 0.4.8: use 'Data.Enumerator.List.generateM' instead -- -- Since: 0.4.5 : :d apidoc Data.Enumerator.head -- | Deprecated in 0.4.5: use 'Data.Enumerator.List.head' instead : :d apidoc Data.Enumerator.isEOF -- | Check whether a stream has reached EOF. Most clients should use -- 'Data.Enumerator.List.head' instead. : :d apidoc Data.Enumerator.iterate -- | Deprecated in 0.4.8: use 'Data.Enumerator.List.iterate' instead -- -- Since: 0.4.5 : :d apidoc Data.Enumerator.iterateM -- | Deprecated in 0.4.8: use 'Data.Enumerator.List.iterateM' instead -- -- Since: 0.4.5 : :d apidoc Data.Enumerator.joinE -- | Flatten an enumerator/enumeratee pair into a single enumerator. : :d apidoc Data.Enumerator.joinI -- | 'joinI' is used to “flatten” 'Enumeratee's into an -- 'Iteratee'. : :d apidoc Data.Enumerator.last -- | Get the last element in the stream, or 'Nothing' if the stream -- has ended. -- -- Consumes the entire stream. : :d apidoc Data.Enumerator.length -- | Get how many elements remained in the stream. -- -- Consumes the entire stream. : :d apidoc Data.Enumerator.liftFoldL -- | Deprecated in 0.4.5: use 'Data.Enumerator.List.fold' instead -- -- Since: 0.1.1 : :d apidoc Data.Enumerator.liftFoldL' -- | Deprecated in 0.4.5: use 'Data.Enumerator.List.fold' instead -- -- Since: 0.1.1 : :d apidoc Data.Enumerator.liftFoldM -- | Deprecated in 0.4.5: use 'Data.Enumerator.List.foldM' instead -- -- Since: 0.1.1 : :d apidoc Data.Enumerator.liftI -- | Deprecated in 0.4.5: use 'Data.Enumerator.continue' instead : :d apidoc Data.Enumerator.liftTrans -- | Lift an 'Iteratee' onto a monad transformer, re-wrapping the -- 'Iteratee'’s inner monadic values. -- -- Since: 0.1.1 : :d apidoc Data.Enumerator.map -- | Deprecated in 0.4.8: use 'Data.Enumerator.List.map' instead : :d apidoc Data.Enumerator.mapM -- | Deprecated in 0.4.8: use 'Data.Enumerator.List.mapM' instead -- -- Since: 0.4.3 : :d apidoc Data.Enumerator.peek -- | Peek at the next element in the stream, or 'Nothing' if the stream -- has ended. : :d apidoc Data.Enumerator.printChunks -- | Print chunks as they're received from the enumerator, optionally -- printing empty chunks. : :d apidoc Data.Enumerator.repeat -- | Deprecated in 0.4.8: use 'Data.Enumerator.List.repeat' instead -- -- Since: 0.4.5 : :d apidoc Data.Enumerator.repeatM -- | Deprecated in 0.4.8: use 'Data.Enumerator.List.repeatM' instead -- -- Since: 0.4.5 : :d apidoc Data.Enumerator.replicate -- | Deprecated in 0.4.8: use 'Data.Enumerator.List.replicate' instead -- -- Since: 0.4.5 : :d apidoc Data.Enumerator.replicateM -- | Deprecated in 0.4.8: use 'Data.Enumerator.List.replicateM' instead -- -- Since: 0.4.5 : :d apidoc Data.Enumerator.returnI -- | @'returnI' step = 'Iteratee' (return step)@ : :d apidoc Data.Enumerator.run -- | Run an iteratee until it finishes, and return either the final value -- (if it succeeded) or the error (if it failed). : :d apidoc Data.Enumerator.run_ -- | Like 'run', except errors are converted to exceptions and thrown. -- Primarily useful for small scripts or other simple cases. -- -- Since: 0.4.1 : :d apidoc Data.Enumerator.sequence -- | Feeds outer input elements into the provided iteratee until it yields -- an inner input, passes that to the inner iteratee, and then loops. : :d apidoc Data.Enumerator.span -- | Deprecated in 0.4.5: use 'Data.Enumerator.List.takeWhile' instead : :d apidoc Data.Enumerator.throwError -- | @'throwError' exc = 'returnI' ('Error' ('Exc.toException' exc))@ : :d apidoc Data.Enumerator.yield -- | @'yield' x extra = 'returnI' ('Yield' x extra)@ -- -- WARNING: due to the current encoding of iteratees in this library, -- careless use of the 'yield' primitive may violate the monad laws. -- To prevent this, always make sure that an iteratee never yields -- extra data unless it has received at least one input element. -- -- More strictly, iteratees may not yield data that they did not -- receive as input. Don't use 'yield' to “inject” elements -- into the stream. : :d apidoc Data.Enumerator.Binary.concatMap -- | @'concatMap' f@ applies /f/ to each input byte and feeds the -- resulting outputs to the inner iteratee. -- -- Since: 0.4.8 : :d apidoc Data.Enumerator.Binary.concatMapM -- | @'concatMapM' f@ applies /f/ to each input byte and feeds the -- resulting outputs to the inner iteratee. -- -- Since: 0.4.8 : :d apidoc Data.Enumerator.Binary.consume -- | @'consume' = 'takeWhile' (const True)@ -- -- Since: 0.4.5 : :d apidoc Data.Enumerator.Binary.drop -- | @'drop' n@ ignores /n/ bytes of input from the stream. -- -- Since: 0.4.5 : :d apidoc Data.Enumerator.Binary.dropWhile -- | @'dropWhile' p@ ignores input from the stream until the first byte -- which does not match the predicate. -- -- Since: 0.4.5 : :d apidoc Data.Enumerator.Binary.enumFile -- | Opens a file path in binary mode, and passes the handle to -- 'enumHandle'. The file will be closed when enumeration finishes. -- -- Since: 0.4.5 : :d apidoc Data.Enumerator.Binary.enumFileRange -- | Opens a file path in binary mode, and passes the handle to -- 'enumHandleRange'. The file will be closed when enumeration finishes. -- -- Since: 0.4.8 : :d apidoc Data.Enumerator.Binary.enumHandle -- | Read bytes (in chunks of the given buffer size) from the handle, and -- stream them to an 'Iteratee'. If an exception occurs during file IO, -- enumeration will stop and 'Error' will be returned. Exceptions from the -- iteratee are not caught. -- -- This enumerator blocks until at least one byte is available from the -- handle, and might read less than the maximum buffer size in some -- cases. -- -- The handle should be opened with no encoding, and in 'IO.ReadMode' or -- 'IO.ReadWriteMode'. -- -- Since: 0.4.5 : :d apidoc Data.Enumerator.Binary.enumHandleRange -- | Read bytes (in chunks of the given buffer size) from the handle, and -- stream them to an 'Iteratee'. If an exception occurs during file IO, -- enumeration will stop and 'Error' will be returned. Exceptions from the -- iteratee are not caught. -- -- This enumerator blocks until at least one byte is available from the -- handle, and might read less than the maximum buffer size in some -- cases. -- -- The handle should be opened with no encoding, and in 'IO.ReadMode' or -- 'IO.ReadWriteMode'. -- -- If an offset is specified, the handle will be seeked to that offset -- before reading. If the handle cannot be seeked, an error will be -- thrown. -- -- If a maximum count is specified, the number of bytes read will not -- exceed that count. -- -- Since: 0.4.8 : :d apidoc Data.Enumerator.Binary.filter -- | Applies a predicate to the stream. The inner iteratee only receives -- characters for which the predicate is @True@. -- -- Since: 0.4.8 : :d apidoc Data.Enumerator.Binary.filterM -- | Applies a monadic predicate to the stream. The inner iteratee only -- receives bytes for which the predicate returns @True@. -- -- Since: 0.4.8 : :d apidoc Data.Enumerator.Binary.fold -- | Consume the entire input stream with a strict left fold, one byte -- at a time. -- -- Since: 0.4.8 : :d apidoc Data.Enumerator.Binary.foldM -- | Consume the entire input stream with a strict monadic left fold, one -- byte at a time. -- -- Since: 0.4.8 : :d apidoc Data.Enumerator.Binary.generateM -- | Like 'repeatM', except the computation may terminate the stream by -- returning 'Nothing'. -- -- Since: 0.4.8 : :d apidoc Data.Enumerator.Binary.head -- | Get the next byte from the stream, or 'Nothing' if the stream has -- ended. -- -- Since: 0.4.5 : :d apidoc Data.Enumerator.Binary.isolate -- | @'isolate' n@ reads at most /n/ bytes from the stream, and passes them -- to its iteratee. If the iteratee finishes early, bytes continue to be -- consumed from the outer stream until /n/ have been consumed. -- -- Since: 0.4.5 : :d apidoc Data.Enumerator.Binary.iterate -- | @'iterate' f x@ enumerates an infinite stream of repeated applications -- of /f/ to /x/. -- -- Analogous to 'Prelude.iterate'. -- -- Since: 0.4.8 : :d apidoc Data.Enumerator.Binary.iterateM -- | Similar to 'iterate', except the iteration function is monadic. -- -- Since: 0.4.8 : :d apidoc Data.Enumerator.Binary.iterHandle -- | Read bytes from a stream and write them to a handle. If an exception -- occurs during file IO, enumeration will stop and 'Error' will be -- returned. -- -- The handle should be opened with no encoding, and in 'IO.WriteMode' or -- 'IO.ReadWriteMode'. -- -- Since: 0.4.5 : :d apidoc Data.Enumerator.Binary.map -- | @'map' f@ applies /f/ to each input byte and feeds the -- resulting outputs to the inner iteratee. -- -- Since: 0.4.8 : :d apidoc Data.Enumerator.Binary.mapM -- | @'mapM' f@ applies /f/ to each input byte and feeds the -- resulting outputs to the inner iteratee. -- -- Since: 0.4.8 : :d apidoc Data.Enumerator.Binary.mapAccum -- | Similar to 'map', but with a stateful step function. -- -- Since: 0.4.9 : :d apidoc Data.Enumerator.Binary.mapAccumM -- | Similar to 'mapM', but with a stateful step function. -- -- Since: 0.4.9 : :d apidoc Data.Enumerator.Binary.repeat -- | Enumerates an infinite stream of a single byte. -- -- Analogous to 'Prelude.repeat'. -- -- Since: 0.4.8 : :d apidoc Data.Enumerator.Binary.repeatM -- | Enumerates an infinite stream of byte. Each byte is computed by the -- underlying monad. -- -- Since: 0.4.8 : :d apidoc Data.Enumerator.Binary.replicate -- | @'replicate' n x@ enumerates a stream containing /n/ copies of /x/. -- -- Since: 0.4.8 : :d apidoc Data.Enumerator.Binary.replicateM -- | @'replicateM' n m_x@ enumerates a stream of /n/ bytes, with each byte -- computed by /m_x/. -- -- Since: 0.4.8 : :d apidoc Data.Enumerator.Binary.require -- | @'require' n@ buffers input until at least /n/ bytes are available, or -- throws an error if the stream ends early. -- -- Since: 0.4.5 : :d apidoc Data.Enumerator.Binary.splitWhen -- | Split on bytes satisfying a given predicate. -- -- Since: 0.4.8 : :d apidoc Data.Enumerator.Binary.take -- | @'take' n@ extracts the next /n/ bytes from the stream, as a lazy -- ByteString. -- -- Since: 0.4.5 : :d apidoc Data.Enumerator.Binary.takeWhile -- | @'takeWhile' p@ extracts input from the stream until the first byte which -- does not match the predicate. -- -- Since: 0.4.5 : :d apidoc Data.Enumerator.Binary.unfold -- | Enumerates a stream of bytes by repeatedly applying a function to -- some state. -- -- Similar to 'iterate'. -- -- Since: 0.4.8 : :d apidoc Data.Enumerator.Binary.unfoldM -- | Enumerates a stream of bytes by repeatedly applying a computation to -- some state. -- -- Similar to 'iterateM'. -- -- Since: 0.4.8 : :d apidoc Data.Enumerator.IO.enumFile -- | Deprecated in 0.4.5: use 'EB.enumFile' instead : :d apidoc Data.Enumerator.IO.enumHandle -- | Deprecated in 0.4.5: use 'EB.enumHandle' instead : :d apidoc Data.Enumerator.IO.iterHandle -- | Deprecated in 0.4.5: use 'EB.iterHandle' instead : :d apidoc Data.Enumerator.List.concatMap -- | @'concatMap' f@ applies /f/ to each input element and feeds the -- resulting outputs to the inner iteratee. -- -- Since: 0.4.8 : :d apidoc Data.Enumerator.List.concatMapM -- | @'concatMapM' f@ applies /f/ to each input element and feeds the -- resulting outputs to the inner iteratee. -- -- Since: 0.4.8 : :d apidoc Data.Enumerator.List.consume -- | @'consume' = 'takeWhile' (const True)@ -- -- Since: 0.4.5 : :d apidoc Data.Enumerator.List.drop -- | @'drop' n@ ignores /n/ input elements from the stream. -- -- Since: 0.4.5 : :d apidoc Data.Enumerator.List.dropWhile -- | @'dropWhile' p@ ignores input from the stream until the first element -- which does not match the predicate. -- -- Since: 0.4.5 : :d apidoc Data.Enumerator.List.filter -- | Applies a predicate to the stream. The inner iteratee only receives -- elements for which the predicate is @True@. -- -- Since: 0.4.8 : :d apidoc Data.Enumerator.List.filterM -- | Applies a monadic predicate to the stream. The inner iteratee only -- receives elements for which the predicate returns @True@. -- -- Since: 0.4.8 : :d apidoc Data.Enumerator.List.fold -- | Consume the entire input stream with a strict left fold, one element -- at a time. -- -- Since: 0.4.8 : :d apidoc Data.Enumerator.List.foldM -- | Consume the entire input stream with a strict monadic left fold, one -- element at a time. -- -- Since: 0.4.8 : :d apidoc Data.Enumerator.List.generateM -- | Like 'repeatM', except the computation may terminate the stream by -- returning 'Nothing'. -- -- Since: 0.4.8 : :d apidoc Data.Enumerator.List.head -- | Get the next element from the stream, or 'Nothing' if the stream has -- ended. -- -- Since: 0.4.5 : :d apidoc Data.Enumerator.List.isolate -- | @'isolate' n@ reads at most /n/ elements from the stream, and passes them -- to its iteratee. If the iteratee finishes early, elements continue to be -- consumed from the outer stream until /n/ have been consumed. -- -- Since: 0.4.5 : :d apidoc Data.Enumerator.List.iterate -- | @'iterate' f x@ enumerates an infinite stream of repeated applications -- of /f/ to /x/. -- -- Analogous to 'Prelude.iterate'. -- -- Since: 0.4.8 : :d apidoc Data.Enumerator.List.iterateM -- | Similar to 'iterate', except the iteration function is monadic. -- -- Since: 0.4.8 : :d apidoc Data.Enumerator.List.map -- | @'map' f@ applies /f/ to each input element and feeds the -- resulting outputs to the inner iteratee. -- -- Since: 0.4.8 : :d apidoc Data.Enumerator.List.mapM -- | @'mapM' f@ applies /f/ to each input element and feeds the -- resulting outputs to the inner iteratee. -- -- Since: 0.4.8 : :d apidoc Data.Enumerator.List.mapAccum -- | Similar to 'map', but with a stateful step function. -- -- Since: 0.4.9 : :d apidoc Data.Enumerator.List.mapAccumM -- | Similar to 'mapM', but with a stateful step function. -- -- Since: 0.4.9 : :d apidoc Data.Enumerator.List.repeat -- | Enumerates an infinite stream of a single element. -- -- Analogous to 'Prelude.repeat'. -- -- Since: 0.4.8 : :d apidoc Data.Enumerator.List.repeatM -- | Enumerates an infinite stream of element. Each element is computed by -- the underlying monad. -- -- Since: 0.4.8 : :d apidoc Data.Enumerator.List.replicate -- | @'replicate' n x@ enumerates a stream containing /n/ copies of /x/. -- -- Analogous to 'Prelude.replicate'. -- -- Since: 0.4.8 : :d apidoc Data.Enumerator.List.replicateM -- | @'replicateM' n m_x@ enumerates a stream of /n/ elements, with each -- element computed by /m_x/. -- -- Since: 0.4.8 : :d apidoc Data.Enumerator.List.require -- | @'require' n@ buffers input until at least /n/ elements are available, or -- throws an error if the stream ends early. -- -- Since: 0.4.5 : :d apidoc Data.Enumerator.List.splitWhen -- | Split on elements satisfying a given predicate. -- -- Since: 0.4.8 : :d apidoc Data.Enumerator.List.take -- | @'take' n@ extracts the next /n/ elements from the stream, as a list. -- -- Since: 0.4.5 : :d apidoc Data.Enumerator.List.takeWhile -- | @'takeWhile' p@ extracts input from the stream until the first element -- which does not match the predicate. -- -- Since: 0.4.5 : :d apidoc Data.Enumerator.List.unfold -- | Enumerates a stream of elements by repeatedly applying a function to -- some state. -- -- Similar to 'iterate'. -- -- Since: 0.4.8 : :d apidoc Data.Enumerator.List.unfoldM -- | Enumerates a stream of elements by repeatedly applying a computation to -- some state. -- -- Similar to 'iterateM'. -- -- Since: 0.4.8 : :d apidoc Data.Enumerator.Text.Codec -- | Since: 0.2 : :d apidoc Data.Enumerator.Text.concatMap -- | @'concatMap' f@ applies /f/ to each input character and feeds the -- resulting outputs to the inner iteratee. -- -- Since: 0.4.8 : :d apidoc Data.Enumerator.Text.concatMapM -- | @'concatMapM' f@ applies /f/ to each input character and feeds the -- resulting outputs to the inner iteratee. -- -- Since: 0.4.8 : :d apidoc Data.Enumerator.Text.consume -- | @'consume' = 'takeWhile' (const True)@ -- -- Since: 0.4.5 : :d apidoc Data.Enumerator.Text.decode -- | Convert bytes into text, using the provided codec. If the codec is -- not capable of decoding an input byte sequence, an error will be thrown. -- -- Since: 0.2 : :d apidoc Data.Enumerator.Text.drop -- | @'drop' n@ ignores /n/ characters of input from the stream. -- -- Since: 0.4.5 : :d apidoc Data.Enumerator.Text.dropWhile -- | @'dropWhile' p@ ignores input from the stream until the first character -- which does not match the predicate. -- -- Since: 0.4.5 : :d apidoc Data.Enumerator.Text.encode -- | Convert text into bytes, using the provided codec. If the codec is -- not capable of representing an input character, an error will be thrown. -- -- Since: 0.2 : :d apidoc Data.Enumerator.Text.enumFile -- | Opens a file path in text mode, and passes the handle to 'enumHandle'. -- The file will be closed when the 'Iteratee' finishes. -- -- Since: 0.2 : :d apidoc Data.Enumerator.Text.enumHandle -- | Read lines of text from the handle, and stream them to an 'Iteratee'. -- If an exception occurs during file IO, enumeration will stop and 'Error' -- will be returned. Exceptions from the iteratee are not caught. -- -- The handle should be opened with an appropriate text encoding, and -- in 'IO.ReadMode' or 'IO.ReadWriteMode'. -- -- Since: 0.2 : :d apidoc Data.Enumerator.Text.filter -- | Applies a predicate to the stream. The inner iteratee only receives -- characters for which the predicate is @True@. -- -- Since: 0.4.8 : :d apidoc Data.Enumerator.Text.filterM -- | Applies a monadic predicate to the stream. The inner iteratee only -- receives characters for which the predicate returns @True@. -- -- Since: 0.4.8 : :d apidoc Data.Enumerator.Text.fold -- | Consume the entire input stream with a strict left fold, one character -- at a time. -- -- Since: 0.4.8 : :d apidoc Data.Enumerator.Text.foldM -- | Consume the entire input stream with a strict monadic left fold, one -- character at a time. -- -- Since: 0.4.8 : :d apidoc Data.Enumerator.Text.generateM -- | Like 'repeatM', except the computation may terminate the stream by -- returning 'Nothing'. -- -- Since: 0.4.8 : :d apidoc Data.Enumerator.Text.head -- | Get the next character from the stream, or 'Nothing' if the stream has -- ended. -- -- Since: 0.4.5 : :d apidoc Data.Enumerator.Text.isolate -- | @'isolate' n@ reads at most /n/ characters from the stream, and passes -- them to its iteratee. If the iteratee finishes early, characters continue -- to be consumed from the outer stream until /n/ have been consumed. -- -- Since: 0.4.5 : :d apidoc Data.Enumerator.Text.iterate -- | @'iterate' f x@ enumerates an infinite stream of repeated applications -- of /f/ to /x/. -- -- Analogous to 'Prelude.iterate'. -- -- Since: 0.4.8 : :d apidoc Data.Enumerator.Text.iterateM -- | Similar to 'iterate', except the iteration function is monadic. -- -- Since: 0.4.8 : :d apidoc Data.Enumerator.Text.iterHandle -- | Read text from a stream and write it to a handle. If an exception -- occurs during file IO, enumeration will stop and 'Error' will be -- returned. -- -- The handle should be opened with an appropriate text encoding, and -- in 'IO.WriteMode' or 'IO.ReadWriteMode'. -- -- Since: 0.2 : :d apidoc Data.Enumerator.Text.lines -- | @'lines' = 'splitWhen' (== '\n')@ -- -- Since: 0.4.8 : :d apidoc Data.Enumerator.Text.map -- | @'map' f@ applies /f/ to each input character and feeds the -- resulting outputs to the inner iteratee. -- -- Since: 0.4.8 : :d apidoc Data.Enumerator.Text.mapM -- | @'mapM' f@ applies /f/ to each input character and feeds the -- resulting outputs to the inner iteratee. -- -- Since: 0.4.8 : :d apidoc Data.Enumerator.Text.mapAccum -- | Similar to 'map', but with a stateful step function. -- -- Since: 0.4.9 : :d apidoc Data.Enumerator.Text.mapAccumM -- | Similar to 'mapM', but with a stateful step function. -- -- Since: 0.4.9 : :d apidoc Data.Enumerator.Text.repeat -- | Enumerates an infinite stream of a single character. -- -- Analogous to 'Prelude.repeat'. -- -- Since: 0.4.8 : :d apidoc Data.Enumerator.Text.repeatM -- | Enumerates an infinite stream of characters. Each character is computed -- by the underlying monad. -- -- Since: 0.4.8 : :d apidoc Data.Enumerator.Text.replicate -- | @'replicate' n x@ enumerates a stream containing /n/ copies of /x/. -- -- Since: 0.4.8 : :d apidoc Data.Enumerator.Text.replicateM -- | @'replicateM' n m_x@ enumerates a stream of /n/ characters, with each -- character computed by /m_x/. -- -- Since: 0.4.8 : :d apidoc Data.Enumerator.Text.require -- | @'require' n@ buffers input until at least /n/ characters are available, -- or throws an error if the stream ends early. -- -- Since: 0.4.5 : :d apidoc Data.Enumerator.Text.splitWhen -- | Split on characters satisfying a given predicate. -- -- Since: 0.4.8 : :d apidoc Data.Enumerator.Text.take -- | @'take' n@ extracts the next /n/ characters from the stream, as a lazy -- Text. -- -- Since: 0.4.5 : :d apidoc Data.Enumerator.Text.takeWhile -- | @'takeWhile' p@ extracts input from the stream until the first character -- which does not match the predicate. -- -- Since: 0.4.5 : :d apidoc Data.Enumerator.Text.unfold -- | Enumerates a stream of characters by repeatedly applying a function to -- some state. -- -- Similar to 'iterate'. -- -- Since: 0.4.8 : :d apidoc Data.Enumerator.Text.unfoldM -- | Enumerates a stream of characters by repeatedly applying a computation -- to some state. -- -- Similar to 'iterateM'. -- -- Since: 0.4.8 : :d apidoc Data.Enumerator.tryIO -- | Try to run an IO computation. If it throws an exception, the exception -- is caught and converted into an {\tt Error}. -- -- Since: 0.4.9 :