F@i      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abc d e f g h GEnable map functions for containers that require class contexts on the  element types. There')s really no reason to ever use this with 2 types that are fully polymorphic, such as Lists. ,Class of streams which can be filled from a i. Typically these , are streams which can be read from a file. 7 The Int parameter is the length of the data in bytes. L N.B. The pointer must not be returned or used after readFromPtr completes. GClass of types that can be used to hold chunks of data within Iteratee  streams. $Length of currently available data. $Test if the current stream is null. -Prepend an element to the front of the data. (Return the first element of the stream. Return the tail of the stream. $First index matching the predicate. 'Split the data at the specified index. "Drop data matching the predicate. Create a stream from a list. Create a list from the stream. #Map a computation over the stream.      "Wrap a Data.ByteString ByteString jk lmnopGAlas, GHC provides no function to read from Fd to an allocated buffer. G The library function fdRead is not appropriate as it returns a string  already. I'!d rather get data from a buffer. C Furthermore, fdRead (at least in GHC) allocates a new buffer each E time it is called. This is a waste. Yet another problem with fdRead 9 is in raising an exception on any IOError or even EOF. I' d rather  avoid exceptions altogether. 4The following fseek procedure throws no exceptions. qrs0poll if file descriptors have something to read - Return the list of read-pending descriptors  93More general enumerator type: enumerator that maps 2 streams (not necessarily in lock-step). This is  a flattened ( `joinI-ed'() EnumeratorN sfrom elfrom sto elto m a :Each enumerator takes an iteratee and returns an iteratee + an Enumerator is an iteratee transformer. = The enumerator normally stops when the stream is terminated F or when the iteratee moves to the done state, whichever comes first. 3 When to stop is of course up to the enumerator... AThe type of the converter from the stream with elements el_outer B to the stream with element el_inner. The result is the iteratee # for the outer stream that uses an `IterateeG el_inner m a' E to process the embedded, inner stream as it reads the outer stream. BIteratee -- a generic stream processor, what is being folded over  a stream  When Iteratee is in the done! state, it contains the computed . result and the remaining part of the stream.  In the cont6 state, the iteratee has not finished the computation  and needs more input. " We assume that all iteratees are good -- given bounded input, G they do the bounded amount of computation and take the bounded amount C of resources. The monad m describes the sort of computations done B by the iteratee as it processes the stream. The monad m could be < the identity monad (for pure computations) or the IO monad B (to let the iteratee store the stream processing results as they  are computed). < We also assume that given a terminated stream, an iteratee L moves to the done state, so the results computed so far could be returned. !"#$%CA stream is a (continuing) sequence of elements bundled in Chunks. < The first two variants indicate termination of the stream. ; Chunk a gives the currently available part of the stream. # The stream is not terminated yet. F The case (null Chunk) signifies a stream with no currently available @ data but which is still continuing. A stream processor should,  informally speaking, ``suspend itself'' and wait for more data  to arrive. &'tMap a function over a stream. (Lift an IterGV result into an  )Run an  and get the result. An ' is sent to the  iteratee as it is run. * Check if a stream has finished ('). +If the iteratee (1) has finished, return its value. If it has not % finished then apply it to the given .  If in error, throw the error. ,The following is a variant( of join in the IterateeGM s el m monad  When el'8 is the same as el, the type of joinI is indeed that of ? true monadic join. However, joinI is subtly different: since  generally el', is different from el, it makes no sense to * continue using the internal, IterateeG el' m a: we no longer  have elements of the type el' to feed to that iteratee. E We thus send EOF to the internal Iteratee and propagate its result. 0 This join function is useful when dealing with `derived iteratees'  for embedded/3nested streams. In particular, joinI is useful to = process the result of take, mapStream, or convStream below. -0Layer a monad transformer over the inner monad. u.BRead a stream to the end and return all of its elements as a list /DRead a stream to the end and return all of its elements as a stream 0CReport and propagate an error. Disregard the input first and then  propagate the error. 1EProduce the EOF error message. If the stream was terminated because / of an error, keep the original error message. 2(Check if an iteratee produces an error.  Returns 'Right a'+ if it completes without errors, otherwise ' Left ErrMsg' B checkErr is useful for iteratees that may not terminate, such as 5 G with an empty stream. In particular, it enables them to be used with  B. 3The analogue of List.break J It takes an element predicate and returns the (possibly empty) prefix of I the stream. None of the characters in the string satisfy the character  predicate. D If the stream is not terminated, the first character on the stream  satisfies the predicate. 4The identity iterator. Doesn't do anything. 5=Attempt to read the next element of the stream and return it 9 Raise a (recoverable) error if the stream is terminated 6>Given a sequence of characters, attempt to match them against = the characters on the stream. Return the count of how many B characters matched. The matched characters are removed from the  stream. % For example, if the stream contains abd, then (heads abc)  will remove the characters ab and return 2. 7?Look ahead at the next element of the stream, without removing  it from the stream. @ Return (Just c) if successful, return Nothing if the stream is ! terminated (by EOF or an error) 8Skip the rest of the stream 9!Seek to a position in the stream :6Skip n elements of the stream, if there are that many # This is the analogue of List.drop ;/Skip all elements while the predicate is true. ( This is the analogue of List.dropWhile <&Return the total length of the stream =BRead n elements from a stream and apply the given iteratee to the H stream of the read elements. Unless the stream is terminated early, we D read exactly n elements (even if the iteratee has accepted fewer). >BRead n elements from a stream and apply the given iteratee to the C stream of the read elements. If the given iteratee accepted fewer  elements, we stop.  This is the variation of = with the early termination K of processing of the outer stream once the processing of the inner stream  finished early. ?1Map the stream: yet another iteratee transformer D Given the stream of elements of the type el and the function el->el', 1 build a nested stream of elements of the type el' and apply the  given iteratee to it.  Note the contravariance @BMap a stream without changing the element type. For StreamChunks / with limited element types (e.g. bytestrings) 8 this can be much more efficient than regular mapStream ACYet another stream mapping function. For container instances with @ class contexts, such as uvector or storablevector, this allows > the native map function to be used and is likely to be much - more efficient than the standard mapStream. B4Convert one stream into another, not necessarily in lockstep @ The transformer mapStream maps one element of the outer stream E to one element of the nested stream. The transformer below is more F general: it may take several elements of the outer stream to produce ; one element of the inner stream, or the other way around. A The transformation from one stream to the other is specified as  IterateeGM s el m (Maybe (s' el'")). The Maybe type is in case of  errors (or end of stream). C>Creates an enumerator with only elements from the stream that ! satisfy the predicate function. DLeft-associative fold. E9Left-associative fold that is strict in the accumulator. FCVariant of foldl with no base case. Requires at least one element  in the stream. GSum of a stream. HProduct of a stream I=Enumerate two iteratees over a single stream simultaneously. JFThe most primitive enumerator: applies the iteratee to the terminated ? stream. The result is the iteratee usually in the done state. K.Another primitive enumerator: report an error LKThe composition of two enumerators: essentially the functional composition H It is convenient to flip the order of the arguments of the composition + though: in e1 >. e2, e1 is executed first MThe pure 1-chunk enumerator A It passes a given list of elements to the iteratee in one chunk F This enumerator does no IO and is useful for testing of base parsing NThe pure n-chunk enumerator A It passes a given chunk of elements to the iteratee in n chunks F This enumerator does no IO and is useful for testing of base parsing " and handling of chunk boundaries O,A variant of join for Iteratees in a monad. : !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNO8"$#%'&! ,(*)O./+-1023;:45678<=>?@ABCDEFGHJKMNLI97! !"$##$%'&&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPIndicate endian-ness. Q/Least Significan Byte is first (little-endian) R,Most Significant Byte is first (big-endian) STGread 3 bytes in an endian manner. If the first bit is set (negative), I set the entire first byte so the Word32 can be properly set negative as  well. UPQRSTUPRQSTUPRQQRSTUVDThe enumerator of a POSIX File Descriptor. This version enumerates A over the entire contents of a file, in order, unless stopped by 9 the iteratee. In particular, seeking is not supported. WFThe enumerator of a POSIX File Descriptor: a variation of enumFd that # supports RandomIO (seek requests) X@Process a file using the given IterateeGM. This function wraps  enumFd as a convenience. Y@Process a file using the given IterateeGM. This function wraps  enumFdRandom as a convenience. VWXYVWXYVWXY Z[\]<A particular instance of StreamG: the stream of characters. , This stream is used by many input parsers. ^&Read the line of text from the stream / The line can be terminated by CR, LF or CRLF. A Return (Right Line) if successful. Return (Left Line) if EOF or @ a stream error were encountered before the terminator is seen. . The returned line is the string read so far. _4Print lines as they are received. This is the first impure iteratee 2 with non-trivial actions during chunk processing `=Read a sequence of lines from the stream up to the empty lin M The line can be terminated by CR, LF, or CRLF -- or by EOF or stream error. K Return the read lines, in order, not including the terminating empty line M Upon EOF or stream error, return the complete, terminated lines accumulated  so far. a=Convert the stream of characters to the stream of lines, and 3 apply the given iteratee to enumerate the latter. ? The stream of lines is normally terminated by the empty line. B When the stream of characters is terminated, the stream of lines ! is also terminated, abnormally. I This is the first proper iteratee-enumerator: it is the iteratee of the 9 character stream and the enumerator of the line stream. b=Convert the stream of characters to the stream of words, and 3 apply the given iteratee to enumerate the latter. % Words are delimited by white space. $ This is the analogue of List.words C One should keep in mind that enumWords is a more general, monadic  function. B !"#$%&'()*+,-./012456789:;<=>?@ABCDEFGHIJKLMNOZ[\]^_`ab ]\Z[^_`ab Z[\]^_`ab c:The enumerator of a file Handle. This version enumerates A over the entire contents of a file, in order, unless stopped by 9 the iteratee. In particular, seeking is not supported. d;The enumerator of a Handle: a variation of enumHandle that # supports RandomIO (seek requests) e@Process a file using the given IterateeGM. This function wraps  enumHandle as a convenience. f@Process a file using the given IterateeGM. This function wraps $ enumHandleRandom as a convenience. cdefcdefcdef g?Process a file using the given IterateeG. This function wraps  enumFd as a convenience. h?Process a file using the given IterateeG. This function wraps  enumFdRandom as a convenience. VWcdghcdVWghgh B !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUghghv    !"#$%&'()*++,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklm n o p q r s tuvwxyz{|}~iteratee-0.3.5Data.Iteratee.IO.PosixData.Iteratee.Base.LooseMapData.Iteratee.Base.StreamChunkData.Iteratee.WrappedByteStringData.Iteratee.BaseData.Iteratee.BinaryData.Iteratee.IO.FdData.Iteratee.CharData.Iteratee.IO.HandleData.Iteratee.IOData.Iteratee.IO.Base Data.IterateebaseSystem.Posix.Types FileOffsetForeign.C.ErrorErrnoLooseMaplooseMap ReadableChunk readFromPtr StreamChunklengthnullconsheadtail findIndexsplitAt dropWhilefromListtoListcMapWrappedByteStringWrapBSunWrapmyfdReadmyfdSeekselect'read'pending EnumeratorGMM EnumeratorGM EnumeratorN IterateeGrunIterIterGVContDoneErrMsgSeekErrStreamGChunkEOFliftIrun isFinished checkIfDonejoinI liftInner stream2list stream2streamthrowErrsetEOFcheckErrbreakidentityheadspeek skipToEofseekdroptaketakeR mapStreamrigidMapStreamlooseMapStream convStreamfilterfoldlfoldl'foldl1sumproductenumPairenumEofenumErr>.enumPure1ChunkenumPureNChunkjoinIMEndianLSBMSB endianRead2 endianRead3 endianRead4enumFd enumFdRandom fileDriverFdfileDriverRandomFd EnumeratorMLineIterateeStreamline printLines readLines enumLines enumWords enumHandleenumHandleRandomfileDriverHandlefileDriverRandomHandle fileDriverfileDriverRandomGHC.PtrPtrbwmapbcmapc_selectcLSeekcReadTIMEVALFDSETfd2fdsfds2mfdunFdstrMapiterBind