Ո      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqr s t u v w x y z { | } ~  GAlas, 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. 0poll if file descriptors have something to read - Return the list of read-pending descriptors ,Class of streams which can be filled from a . Typically these , are streams which can be read from a file. 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 ,3More 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. $%Map a function over a stream. &'()HIf the iteratee (IterGV) has finished, return its value. If it has not 3 finished then apply it to the given EnumeratorGM.  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. +BRead a stream to the end and return all of its elements as a list ,CReport and propagate an error. Disregard the input first and then  propagate the error. -EProduce the EOF error message. If the stream was terminated because / of an error, keep the original error message. .(Check if an iteratee produces an error.  Returns 'Right a'+ if it completes without errors, otherwise ' Left ErrMsg' /The 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. 0The identity iterator. Doesn't do anything. 1=Attempt to read the next element of the stream and return it 9 Raise a (recoverable) error if the stream is terminated 2>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. 3?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) 4Skip the rest of the stream 5!Seek to a position in the stream 66Skip n elements of the stream, if there are that many # This is the analogue of List.drop 7BRead 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). 8BRead 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 7 with the early termination K of processing of the outer stream once the processing of the inner stream  finished early. 91Map 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 :4Convert 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). ;FThe most primitive enumerator: applies the iteratee to the terminated ? stream. The result is the iteratee usually in the done state. <.Another primitive enumerator: report an error =KThe 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 >The 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 ?The 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 @,A variant of join for Iteratees in a monad. + !"#$%&'()*+,-./0123456789:;<=>?@+ "!#%$*&('@+)-,./6012345789:;<=>?* "!!"#%$$%&'()*+,-./0123456789:;<=>?@AIndicate endian-ness. B/Least Significan Byte is first (little-endian) C,Most Significant Byte is first (big-endian) DEGread 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. FABCDEFACBDEFACBBCDEF GHIJ<A particular instance of StreamG: the stream of characters. , This stream is used by many input parsers. K&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. L4Print lines as they are received. This is the first impure iteratee 2 with non-trivial actions during chunk processing M=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. N=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. O=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. 3 !"#$%&'()*+,-.0123456789:;<=>?@GHIJKLMNO JIGHKLMNO GHIJKLMNO+PQR%Number of channels in the audio data SSample rate of the audio TBit depth of the audio data UStandard WAVE Chunks VOther WData XFormat YZ[\]^length of chunk _type of chunk `"enumerator to get values of chunk 8A WAVE directory is a list associating WAVE chunks with  a record WAVEDE a$Convert a string to WAVE_CHUNK type b2Convert a WAVE_CHUNK to the representative string c1The library function to read the WAVE dictionary d Read the RIFF header of a file. 'Read the WAVE part of the RIFF header. BAn internal function to find all the chunks. It assumes that the / stream is positioned to read the first chunk. Convert Word8s to Doubles (An Iteratee to read a wave format chunk e4Read the first format chunk in the WAVE dictionary. fERead the last fromat chunk from the WAVE dictionary. This is useful , when parsing all chunks in the dictionary. g9Read the specified format chunk from the WAVE dictionary h2Read the first data chunk in the WAVE dictionary. i1Read the last data chunk in the WAVE dictionary. j8Read the specified data chunk from the WAVE dictionary. k@Read the specified data chunk from the dictionary, applying the " data to the specified IterateeG. Convert (Maybe []) to []". Nothing maps to an empty list. 4Normalize a given value for the provided bit depth. PQRSTUVWXYZ[\]^_`abcdefghijk\]^_`Y[ZUXWVPQRSTcdabgefhijkPQRSTQRSTUXWVVWXY[ZZ[\]^_`]^_`abcdefghijk l: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. m;The enumerator of a Handle: a variation of enumHandle that # supports RandomIO (seek requests) @Process a file using the given IterateeGM. This function wraps  enumHandle as a convenience. @Process a file using the given IterateeGM. This function wraps $ enumHandleRandom as a convenience. lmlm nDThe 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. oFThe enumerator of a POSIX File Descriptor: a variation of enumFd that # supports RandomIO (seek requests) @Process a file using the given IterateeGM. This function wraps  enumFd as a convenience. @Process a file using the given IterateeGM. This function wraps  enumFdRandom as a convenience. nonop?Process a file using the given IterateeG. This function wraps  enumFd as a convenience. q?Process a file using the given IterateeG. This function wraps  enumFdRandom as a convenience. lmnopqlmnopqpq 3 !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFpqpq _rstuvwxyz{|}~_rstuvwxyz{|}~_r~}|{zyxwvuts_r3~}|{zyxwvutsstuvwxyz{|}~     !"#$%&'()**+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^^_`abcdefghiijklmnopqrstuvw x y z {|} ~                                                                              iteratee-0.2Data.Iteratee.IO.BaseData.Iteratee.Base.StreamChunkData.Iteratee.WrappedByteStringData.Iteratee.BaseData.Iteratee.BinaryData.Iteratee.CharData.Iteratee.Codecs.WaveData.Iteratee.IOData.Iteratee.Codecs.TiffData.Iteratee.IO.PosixData.Iteratee.IO.HandleData.Iteratee.IO.Fd Data.IterateebaseSystem.Posix.Types FileOffsetForeign.C.ErrorErrnomyfdReadmyfdSeekselect'read'pending ReadableChunk readFromPtr StreamChunklengthnullconsheadtail findIndexsplitAt dropWhilefromListtoListcMapWrappedByteStringWrapBSunWrap EnumeratorGMM EnumeratorGM EnumeratorN IterateeGrunIterIterGVContDoneErrMsgSeekErrStreamGChunkEOFliftIrun isFinished checkIfDonejoinI stream2listthrowErrsetEOFcheckErrbreakidentityheadspeek skipToEofseekdroptaketakeR mapStream convStreamenumEofenumErr>.enumPure1ChunkenumPureNChunkjoinIMEndianLSBMSB endianRead2 endianRead3 endianRead4 EnumeratorMLineIterateeStreamline printLines readLines enumLines enumWords AudioFormatnumberOfChannels sampleRatebitDepth WAVE_CHUNK WAVE_OTHER WAVE_DATAWAVE_FMT WAVEDE_ENUMWEN_DUBWEN_BYTEWAVEDE wavede_count wavede_type wavede_enum waveChunk chunkToString waveReaderreadRiffdictReadFirstFormatdictReadLastFormatdictReadFormatdictReadFirstDatadictReadLastData dictReadDatadictProcessData enumHandleenumHandleRandomenumFd enumFdRandom fileDriverfileDriverRandomTIFF_TAG TG_MATTEINGTG_CONSECUTIVEBADFAXLINESTG_CLEANFAXDATATG_BADFAXLINES TG_COLORMAPTG_PRIMARYCHROMATICITIES TG_WHITEPOINT TG_PREDICTORTG_HOSTCOMPUTER TG_ARTIST TG_DATETIME TG_SOFTWARETG_COLORRESPONSECURVETG_COLORRESPONSEUNIT TG_PAGENUMBERTG_RESOLUTIONUNITTG_GROUP4OPTIONSTG_GROUP3OPTIONSTG_GRAYRESPONSECURVETG_GRAYRESPONSEUNITTG_FREEBYTECOUNTSTG_FREEOFFSETS TG_YPOSITION TG_XPOSITION TG_PAGENAMETG_PLANARCONFIGTG_YRESOLUTIONTG_XRESOLUTIONTG_MAXSAMPLEVALUETG_MINSAMPLEVALUETG_STRIPBYTECOUNTSTG_ROWSPERSTRIPTG_SAMPLESPERPIXELTG_ORIENTATIONTG_STRIPOFFSETSTG_MODELTG_MAKETG_IMAGEDESCRIPTIONTG_DOCUMENTNAME TG_FILLORDER TG_CELLLENGTH TG_CELLWIDTHTG_THRESHOLDINGTG_PHOTOMETRICTG_COMPRESSIONTG_BITSPERSAMPLETG_IMAGELENGTH TG_IMAGEWIDTHTG_OSUBFILETYPETG_SUBFILETYPETG_other TIFF_TYPE TT_doubleTT_float TT_srationalTT_slong TT_sshort TT_undefinedTT_sbyte TT_rationalTT_longTT_shortTT_asciiTT_byteTT_NONE TIFFDE_ENUMTEN_RATTEN_INTTEN_BYTETEN_CHARTIFFDE tiffde_count tiffde_enumTIFFDict process_tiff compute_histverify_pixel_valstag_maptag_map' tag_to_int int_to_tag tiff_reader u32_to_float u32_to_s32 u16_to_s16u8_to_s8note load_dictpixel_matrix_enum dict_read_intdict_read_ints dict_read_ratdict_read_stringc_selectcLSeekcReadTIMEVALFDSETfd2fdsfds2mfdunFdGHC.PtrPtrlistmapbwmapbwmap'bcmapbcmap'strMapiterBindBitDepth SampleRate NumChannelsWAVEDictL stringRead4 readRiffWave findChunksloadDict readValueconvFunc eitherToMaybe sWaveFormatjoinM normalizefileDriverHandlefileDriverRandomHandle fileDriverFdfileDriverRandomFd