\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 -- -- 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 -- -- 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.(<==<) -- | @(\<==\<) = 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.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 -- | @concatMap f = 'concatMapM' (return . f)@ -- -- Since: 0.4.3 : :d apidoc Data.Enumerator.concatMapM -- | @concatMapM f@ applies /f/ to each input element and feeds the -- resulting outputs to the inner iteratee. -- -- 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 -- | docs TODO : :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 -- | @filter p = 'concatMap' (\x -> 'Prelude.filter' p [x])@ -- -- Since: 0.4.5 : :d apidoc Data.Enumerator.filterM -- | @filterM p = 'concatMapM' (\x -> 'CM.filterM' p [x])@ -- -- Since: 0.4.5 : :d apidoc Data.Enumerator.foldl -- | Run the entire input stream through a pure left fold, yielding when -- there is no more input. -- -- Since: 0.4.5 : :d apidoc Data.Enumerator.foldl' -- | Run the entire input stream through a pure strict left fold, yielding -- when there is no more input. -- -- Since: 0.4.5 : :d apidoc Data.Enumerator.foldM -- | Run the entire input stream through a monadic left fold, yielding -- when there is no more input. -- -- Since: 0.4.5 : :d apidoc Data.Enumerator.generateM -- | Like 'repeatM', except the computation may terminate the stream by -- returning 'Nothing'. -- -- 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 -- | docs TODO : :d apidoc Data.Enumerator.iterate -- | @iterate f x@ enumerates an infinite stream of repeated applications -- of /f/ to /x/. -- -- Analogous to 'Prelude.iterate'. -- -- Since: 0.4.5 : :d apidoc Data.Enumerator.iterateM -- | Similar to 'iterate', except the iteration function is monadic. -- -- 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.foldl' instead -- -- Since: 0.1.1 : :d apidoc Data.Enumerator.liftFoldL' -- | Deprecated in 0.4.5: use 'Data.Enumerator.foldl'' instead -- -- Since: 0.1.1 : :d apidoc Data.Enumerator.liftFoldM -- | Deprecated in 0.4.5: use 'Data.Enumerator.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 -- | @map f = 'concatMap' (\x -> 'Prelude.map' f [x])@ : :d apidoc Data.Enumerator.mapM -- | @mapM f = 'concatMapM' (\x -> 'Prelude.mapM' f [x])@ -- -- 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 -- | Enumerates an infinite stream of the provided value. -- -- Analogous to 'Prelude.repeat'. -- -- Since: 0.4.5 : :d apidoc Data.Enumerator.repeatM -- | Enumerates an infinite stream by running the provided computation and -- passing each result to the iteratee. -- -- Since: 0.4.5 : :d apidoc Data.Enumerator.replicate -- | @replicate n x = 'replicateM' n (return x)@ -- -- Analogous to 'Prelude.replicate'. -- -- Since: 0.4.5 : :d apidoc Data.Enumerator.replicateM -- | @replicateM n m_x@ enumerates a stream of /n/ input elements; each -- element is generated by running the input computation /m_x/ once. -- -- 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)@ : :d apidoc Data.Enumerator.Binary.consume -- | Read all remaining input from the stream, and return as a lazy -- ByteString. -- -- 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 the 'Iteratee' finishes. : :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'. : :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.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'. : :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.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.IO.enumFile -- | Deprecated in 0.4.5: use 'Data.Enumerator.Binary.enumFile' instead : :d apidoc Data.Enumerator.IO.enumHandle -- | Deprecated in 0.4.5: use 'Data.Enumerator.Binary.enumHandle' instead : :d apidoc Data.Enumerator.IO.iterHandle -- | Deprecated in 0.4.5: use 'Data.Enumerator.Binary.iterHandle' instead : :d apidoc Data.Enumerator.List.consume -- | Read all remaining input elements from the stream, and return as a list. -- -- 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.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.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.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.Text.Codec -- | docs TODO -- -- Since: 0.2 : :d apidoc Data.Enumerator.Text.consume -- | Read all remaining input from the stream, and return as a lazy -- Text. -- -- 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.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.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.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.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 :