Ә      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ 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. Create an empty chunk of 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. #Append to chunks of data into one. 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. $%&'A useful combinator. (Lift an  into an . ):Just like bind (at run-time, this is indeed exactly bind) *=Just like an application -- a call-by-value-like application +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. .'Check to see if the stream is in error /The analogue of List.break 3 It takes an element predicate and returns a pair:  (str, Just c) -- the element c$ is the first element of the stream 3 satisfying the break predicate; @ The chunk str is the prefix of the stream up $ to but including c E (str,Nothing) -- The stream is terminated with EOF or error before I any element satisfying the break predicate was found. : str is the scanned part of the stream. 9 None of the element in str satisfy the break predicate. 0A particular optimized case of 4": skip all elements of the stream : satisfying the given predicate - until the first element @ that does not satisfy the predicate, or the end of the stream. ( This is the analogue of List.dropWhile 1/Attempt to read the next element of the stream @ Return (Just c) if successful, return Nothing if the stream is ! terminated (by EOF or an error) 2?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) 3Skip the rest of the stream 46Skip n elements of the stream, if there are that many # This is the analogue of List.drop 5FCreate a request to seek within an input stream. This will result in L an error if the enumerator is not capable of responding to a seek request. 6BRead 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). 7BRead 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 6 with the early termination K of processing of the outer stream once the processing of the inner stream E finished early. This variation is particularly useful for randomIO, ! where we do not have to care to `drain the input stream'. 81Map 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 94Convert 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 [el']). The  type reflects the & possibility of the conversion error. :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 @ It passes a given lift 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 ' !"#$%&'()*+,-./0123456789:;<=>'#&%$"! ()*+,-./0412356789:;<=>'&"! !"#&%$$%&'()*+,-./0123456789:;<=>?Indicate endian-ness. @/Least Significan Byte is first (little-endian) A,Most Significant Byte is first (big-endian) BCGread 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. D?@ABCD?A@BCD?A@@ABCD EFGHI<A particular instance of StreamG: the stream of characters. , This stream is used by many input parsers. J&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. K4Print lines as they are received. This is the first impure iteratee 2 with non-trivial actions during chunk processing L=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. M=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 D One should keep in mind that enum_words is a more general, monadic  function. #$%&(*EFGHIJKLM IHGEFJKLM EFGHIJKLM+NOP%Number of channels in the audio data QSample rate of the audio RBit depth of the audio data SStandard WAVE Chunks TOther UData VFormat WXYZ[\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 _$Convert a string to WAVE_CHUNK type `2Convert a WAVE_CHUNK to the representative string a1The library function to read the WAVE dictionary b 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 c4Read the first format chunk in the WAVE dictionary. dERead the last fromat chunk from the WAVE dictionary. This is useful , when parsing all chunks in the dictionary. e9Read the specified format chunk from the WAVE dictionary f2Read the first data chunk in the WAVE dictionary. g1Read the last data chunk in the WAVE dictionary. h8Read the specified data chunk from the WAVE dictionary. i@Read the specified data chunk from the dictionary, applying the # data to the specified IterateeGM. Convert (Maybe []) to []". Nothing maps to an empty list. 4Normalize a given value for the provided bit depth. NOPQRSTUVWXYZ[\]^_`abcdefghiZ[\]^WYXSVUTNOPQRab_`ecdfghiNOPQROPQRSVUTTUVWYXXYZ[\]^[\]^_`abcdefghi_jklmnopqrstuvwxyz{|}~_jklmnopqrstuvwxyz{|}~_j~}|{zyxwvutsrqponmlk_j3~}|{zyxwvutsrqponmlkklmnopqrstuvwxyz{|}~  :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. FThe 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  enumHandle as a convenience. @Process a file using the given IterateeGM. This function wraps $ enumHandleRandom as a convenience.  DThe 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. FThe 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.  @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.  . !"#$%&'()*+,-./0123456789:;<=>?@ABCD    !"#$%&'()*+,-./0123456789:;<=>?!@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefgghijklmnopqrstuvwxyz{|}~    iteratee-0.1.0Data.Iteratee.IO.BaseData.Iteratee.Base.StreamChunkData.Iteratee.WrappedByteStringData.Iteratee.BaseData.Iteratee.BinaryData.Iteratee.CharData.Iteratee.Codecs.WaveData.Iteratee.Codecs.TiffData.Iteratee.IOData.Iteratee.IO.PosixData.Iteratee.IO.HandleData.Iteratee.IO.Fd Data.IterateebaseSystem.Posix.Types FileOffsetForeign.C.ErrorErrnomyfdReadmyfdSeekselect'read'pending ReadableChunk readFromPtr StreamChunklengthemptynullconsheadtail findIndexsplitAt dropWhileappendfromListtoListcMapWrappedByteStringWrapBSunWrap EnumeratorGMM EnumeratorGM EnumeratorN IterateeGMIMunIM IterateeGSeekContDoneStreamGChunkErrorEOFbindmliftI>>====<<joinI stream2listiterErriterReportErrorbreakpeek skipToEofdropseektaketakeR mapStream convStreamenumEofenumErr>.enumPure1ChunkenumPureNChunkEndianLSBMSB endian_read2 endian_read3 endian_read4 EnumeratorMLine IterateeMIterateeStreamline print_lines enum_lines enum_words AudioFormatnumberOfChannels sampleRatebitDepth WAVE_CHUNK WAVE_OTHER WAVE_DATAWAVE_FMT WAVEDE_ENUMWEN_DUBWEN_BYTEWAVEDE wavede_count wavede_type wavede_enum wave_chunkchunk_to_string wave_reader read_riffdict_read_first_formatdict_read_last_formatdict_read_formatdict_read_first_datadict_read_last_datadict_read_datadict_process_dataTIFF_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_string enumHandleenumHandleRandomenumFd enumFdRandom fileDriverfileDriverRandomc_selectcLSeekcReadTIMEVALFDSETfd2fdsfds2mfdunFdGHC.PtrPtrlistmapbwmapbwmap'bcmapbcmap' iter_bind Data.MaybeMaybeBitDepth SampleRate NumChannelsWAVEDictL string_read4read_riff_wave find_chunks read_valueunroller conv_func sWaveFormatjoin_m normalizefileDriverHandlefileDriverRandomHandle fileDriverFdfileDriverRandomFd