^T3      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~   Safe-InferedGEnable map functions for containers that require class contexts on the 7 element types. For lists, this is identical to plain .  Safe-InferedLNullPoint class. Containers that have a null representation, corresponding  to Data.Monoid.mempty.  Safe-InferedNullable container class  Safe-Infered ,Class of streams which can be filled from a . Typically these , are streams which can be read from a file, Handle, or similar resource. #The pointer must not be used after  readFromPtr completes. 8The Int parameter is the length of the data in *bytes*.      Safe-Infered 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       Safe-Infered  Safe-Infered An Iteratee exception specified by a String. The Iteratee needs more data but received EOF. A seek request within an Iteratee. Root of iteratee exceptions.  A class for iteratee exceptions. Only inheritants of  IterException $ should be instances of this class. The enumerator received an  it could not handle. &Create an enumerator exception from a String. The iteratee diverged upon receiving EOF. !+Root of the Iteratee exception hierarchy.  IFException derives from  Control.Exception.SomeException. , , ( and all inheritants are descendents of !. # Create an  from a string. $ Convert an  to an . Meant to be used  within an  Enumerator) to signify that it could not handle the   IterException. ' Create an iteratee exception from a string. ! This convenience function wraps  and . * !"#$%&' !"#$%&'!" #'$%& !"#$%&' Safe-Infered (Monadic iteratee +)Describe the status of a stream of data. /CA stream is a (continuing) sequence of elements bundled in Chunks. 8 The first variant indicates 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. 2 Produce the 16 error message. If the stream was terminated because & of an error, keep the error message. 8Send 1 to the Iteratee* and disregard the unconsumed part of the F stream. If the iteratee is in an exception state, that exception is  thrown with #. Iteratees that do not terminate  on EOF will throw . 9HRun an iteratee, returning either the result or the iteratee exception. J Note that only internal iteratee exceptions will be returned; exceptions  thrown with Control.Exception.throw or Control.Monad.CatchIO.throw will  not be returned.  See ! for details. :"Transform a computation inside an Iteratee. ;6Lift a computation in the inner monad of an iteratee. BA simple use would be to lift a logger iteratee to a monad stack.  ! logger :: Iteratee String IO ()  logger = mapChunksM_ putStrLn  . loggerG :: MonadIO m => Iteratee String m ()  loggerG = ilift liftIO logger FA more complex example would involve lifting an iteratee to work with * interleaved streams. See the example at  . Map a function over a stream. ()*+,-./0123456789:;4 !"#$%&'()*+,-./0123456789:;/10+.-,()*89:;345672()*+.-,/1023456789:; Safe-Infered<: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... >-Report and propagate an unrecoverable error. F Disregard the input first and then propagate the error. This error  cannot be handled by Z, although it can be cleared  by @. ?HReport and propagate a recoverable error. This error can be handled by  both Z and @. @(Check if an iteratee produces an error.  Returns Right a+ if it completes without errors, otherwise  Left SomeException. @& is useful for iteratees that may not  terminate, such as Data.Iteratee.head with an empty stream. AThe identity iteratee. Doesn't do any processing of input. B&Get the stream status of an iteratee. CSkip the rest of the stream D!Seek to a position in the stream EDMap a monadic function over the chunks of the stream and ignore the I result. Useful for creating efficient monadic iteratee consumers, e.g.  + logger = mapChunksM_ (liftIO . putStrLn) Bthese can be efficiently run in parallel with other iteratees via  Data.Iteratee.ListLike.zip. FPerform a parallel map/ reduce. The bufsize parameter controls E the maximum number of chunks to read at one time. A larger bufsize ? allows for greater parallelism, but will require more memory. Implementation of sum C sum :: (Monad m, LL.ListLike s, Nullable s) => Iteratee s m Int64 - sum = getSum <$> mapReduce 4 (Sum . LL.sum) G'Get the current chunk from the stream. H*Get a list of all chunks from the stream. IJUtility function for creating enumeratees. Typical usage is demonstrated  by the breakE definition.  breakE / :: (Monad m, LL.ListLike s el, NullPoint s)  => (el -> Bool)  -> Enumeratee s s m a / breakE cpred = eneeCheckIfDone (liftI . step)  where  step k (Chunk s) % | LL.null s = liftI (step k) / | otherwise = case LL.break cpred s of  (str', tail') N | LL.null tail' -> eneeCheckIfDone (liftI . step) . k $ Chunk str' C | otherwise -> idone (k $ Chunk str') (Chunk tail') 6 step k stream = idone (k stream) stream JDConvert one stream into another with the supplied mapping function. B This function operates on whole chunks at a time, contrasting to   mapStream$ which operates on single elements. 1 unpacker :: Enumeratee B.ByteString [Word8] m a  unpacker = mapChunks B.unpack K>Convert 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  Iteratee s m s'. LIThe most general stream converter. Given a function to produce iteratee G transformers and an initial state, convert the stream using iteratees J generated by the function while continually updating the internal state. MACollapse a nested iteratee. The inner iteratee is terminated by EOF. - Errors are propagated through the result. GThe stream resumes from the point of the outer iteratee; any remaining , input in the inner iteratee will be lost.  Differs from + in that the inner iteratee is terminated, 8 and may have a different stream type than the result. N0Lift an iteratee inside a monad to an iteratee. O6Applies the iteratee to the given stream. This wraps P,  Q, and V%, calling the appropriate enumerator  based upon /. PFThe most primitive enumerator: applies the iteratee to the terminated G stream. The result is the iteratee in the Done state. It is an error , if the iteratee does not terminate on EOF. QFAnother primitive enumerator: tell the Iteratee the stream terminated  with an error. RKThe 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 SEnumeratee composition K Run the second enumeratee within the first. In this example, stream2list  is run within the 'take 10', which is itself run within 'take 15' , resulting  in 15 elements being consumed Yrun =<< enumPure1Chunk [1..1000 :: Int] (joinI $ (I.take 15 ><> I.take 10) I.stream2list)[1,2,3,4,5,6,7,8,9,10]T7enumeratee composition with the arguments flipped, see S UDCombine enumeration over two streams. The merging enumeratee would  typically be the result of   or    (see merge for example). VThe pure 1-chunk enumerator @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 WEnumerate chunks from a list X$Checks if an iteratee has finished. CThis enumerator runs the iteratee, performing any monadic actions. 7 If the result is True, the returned iteratee is done. Y.Create an enumerator from a callback function ZICreate an enumerator from a callback function with an exception handler. F The exception handler is called if an iteratee reports an exception. !<=>?@ABCDEF!maximum number of chunks to read  map function GHIJKLMNOPQRSTUinner enumerator outer enumerator merging enumeratee VWXYZT !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ >?@ACBEFGHJKLMN<=OPQVWXYZRIUSTD!<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ  Safe-Infered%[Check if a stream has received 1. \CRead a stream to the end and return all of its elements as a list. < This iteratee returns all data from the stream *strictly*. ]ERead a stream to the end and return all of its elements as a stream. < This iteratee returns all data from the stream *strictly*. ^FTakes an element predicate and returns the (possibly empty) prefix of I the stream. None of the characters in the string satisfy the character  predicate. N If the stream is not terminated, the first character of the remaining stream  satisfies the predicate. N.B. i! should be used in preference to break.  break< will retain all data until the predicate is met, which may  result in a space leak. The analogue of  List.break _=Attempt to read the next element of the stream and return it 9 Raise a (recoverable) error if the stream is terminated The analogue of  List.head `=Attempt to read the last element of the stream and return it 9 Raise a (recoverable) error if the stream is terminated The analogue of  List.last a>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. b?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 1. cReturn a chunk of t! elements length while consuming d elements + from the stream. Useful for creating a 'rolling average' with  K. d7Drop n elements of the stream, if there are that many. The analogue of  List.drop e/Skip all elements while the predicate is true. The analogue of List.dropWhile f=Return the total length of the remaining part of the stream. -This forces evaluation of the entire stream. The analogue of  List.length g(Get the length of the current chunk, or Nothing if 1. !This function consumes no input. hTake n8 elements from the current chunk, or the whole chunk if  n is greater. iATakes an element predicate and an iteratee, running the iteratee ; on all elements of the stream until the predicate is met. the following rule relates break to breakE  break pred === joinI (breakE pred stream2stream) breakE! should be used in preference to break whenever possible. jBRead 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 C read exactly n elements, even if the iteratee has accepted fewer. The analogue of  List.take kBRead 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 j with the early termination K of processing of the outer stream once the processing of the inner stream  finished early. Iteratees composed with k& will consume only enough elements to H reach a done state. Any remaining data will be available in the outer  stream.   > let iter = do  h <- joinI $ takeUpTo 5 I.head  t <- stream2list  return (h,t)  8 > enumPureNChunk [1..10::Int] 3 iter >>= run >>= print  (1,[2,3,4,5,6,7,8,9,10])  8 > enumPureNChunk [1..10::Int] 7 iter >>= run >>= print  (1,[2,3,4,5,6,7,8,9,10]) in each case, I.head4 consumes only one element, returning the remaining  4 elements to the outer stream l-Map the stream: another iteratee transformer * Given the stream of elements of the type el and the function (el->el'), / build a nested stream of elements of the type el' and apply the  given iteratee to it. The analog of List.map mMap the stream rigidly. Like l&, but the element type cannot change.  This function is necessary for  ByteString and similar types  that cannot have ' instances, and may be more efficient. n Creates an  enumeratee) with only elements from the stream that K satisfy the predicate function. The outer stream is completely consumed. The analogue of  List.filter o Creates an =' in which elements from the stream are  grouped into sz/-sized blocks. The outer stream is completely 2 consumed and the final block may be smaller than sz. p Creates an  enumeratee$ in which elements are grouped into < contiguous blocks that are equal according to a predicate. The analogue of  q>Merge offers another way to nest iteratees: as a monad stack. D This allows for the possibility of interleaving data from multiple  streams. / -- print each element from a stream of lines. 5 logger :: (MonadIO m) => Iteratee [ByteString] m () / logger = mapM_ (liftIO . putStrLn . B.unpack)  / -- combine alternating lines from two sources 7 -- To see how this was derived, follow the types from - -- 'ileaveStream logger' and work outwards. 4 run =<< enumFile 10 "file1" (joinI $ enumLinesBS $ ? ( enumFile 10 "file2" . joinI . enumLinesBS $ joinI 0 (ileaveLines logger)) >>= run)  % ileaveLines :: (Functor m, Monad m) E => Enumeratee [ByteString] [ByteString] (Iteratee [ByteString] m)  [ByteString]  ileaveLines = merge (\l1 l2 -> 2 [B.pack "f1:\n\t" ,l1 ,B.pack "f2:\n\t" ,l2 ]   rAA version of merge which operates on chunks instead of elements. 'mergeByChunks offers more control than q. q terminates G when the first stream terminates, however mergeByChunks will continue # until both streams are exhausted. r: guarantees that both chunks passed to the merge function F will have the same number of elements, although that number may vary  between calls. sLeft-associative fold. The analogue of  List.foldl t9Left-associative fold that is strict in the accumulator. / This function should be used in preference to s whenever possible. The analogue of  List.foldl'. uCVariant of foldl with no base case. Requires at least one element  in the stream. The analogue of  List.foldl1. vStrict variant of u. wSum of a stream. xProduct of a stream. y=Enumerate two iteratees over a single stream simultaneously.  Deprecated, use z instead.  Compare to zip. z=Enumerate two iteratees over a single stream simultaneously.  Compare to List.zip. ~GEnumerate over two iteratees in parallel as long as the first iteratee L is still consuming input. The second iteratee will be terminated with EOF H when the first iteratee has completed. An example use is to determine - how many elements an iteratee has consumed:  * snd <$> enumWith (dropWhile (<5)) length  Compare to zip BEnumerate a list of iteratees over a single stream simultaneously C and discard the results. This is a different behavior than Prelude's A sequence_ which runs iteratees in the list one after the other.  Compare to Prelude.sequence_. The pure n-chunk enumerator 9 It passes a given stream of elements to the iteratee in n-sized chunks. FMap a monadic function over the elements of the stream and ignore the  result. The analogue of Control.Monad.foldM ([\]^_`abclength of chunk (t) amount to consume (d) defghijnumber of elements to consume klmnosize of group pqrmerge function stuvwxyz{|}~| !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~([\]^ed_`abcfghijklmnopqrstuvwxy~z{|}([\]^_`abcdefghijklmnopqrstuvwxyz{|}~  Safe-Infered4Print lines as they are received. This is the first impure iteratee 2 with non-trivial actions during chunk processing .Only lines ending with a newline are printed, + data terminated with EOF is not printed. "Print lines as they are received. @All lines are printed, including a line with a terminating EOF. < If the final line is terminated by EOF without a newline,  no newline is printed. J this function should be used in preference to printLines when possible, + as it is more efficient with long lines. =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. I This is the first proper iteratee-enumerator: it is the iteratee of the 9 character stream and the enumerator of the line stream. =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   Safe-InferedIndicate endian-ness. /Least Significan Byte is first (little-endian) ,Most Significant Byte is first (big-endian) GRead 3 bytes in an endian manner. If the first bit is set (negative), < set the entire first byte so the Int32 will be negative as  well.   Safe-InferedDThe 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. :A variant of enumFd that catches exceptions raised by the Iteratee. :The enumerator of a POSIX File Descriptor: a variation of enumFd that $ supports RandomIO (seek requests). Process a file using the given Iteratee. 1A version of fileDriverFd that supports seeking. !Buffer size (number of elements)  Buffer size  Buffer size   Safe-InferedDThe (monadic) 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. 3 Data is read into a buffer of the specified size. AAn enumerator of a file handle that catches exceptions raised by  the Iteratee. ;The enumerator of a Handle: a variation of enumHandle that $ supports RandomIO (seek requests). 3 Data is read into a buffer of the specified size. Process a file using the given Iteratee. This function wraps   enumHandle as a convenience.  A version of fileDriverHandle that supports seeking. *Buffer size (number of elements per read) *Buffer size (number of elements per read) *Buffer size (number of elements per read)  Buffer size  Buffer size !Buffer size (number of elements) !Buffer size (number of elements)  Safe-InferedThe default buffer size. >Process a file using the given Iteratee. This function wraps  enumFd as a convenience. IA version of fileDriver with a user-specified buffer size (in elements). >Process a file using the given Iteratee. This function wraps  enumFdRandom as a convenience.   Safe-Infered !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ Safe-Infered3Use an IO function to choose what iteratee to run. 9 -- Typically this function handles user interaction and + -- returns with a simple iteratee such as _ or D.  -- * -- The IO function takes a value of type a as input, and  -- should return 'Right a' to continue, or 'Left b' 7 -- to terminate. Upon termination, ioIter will return 'Done b'.  --  -- The second argument to  is used as the initial input = -- to the IO function, and on each successive iteration the A -- previously returned value is used as input. Put another way,  -- the value of type a" is used like a fold accumulator.  -- The value of type b( is typically some form of control code D -- that the application uses to signal the reason for termination.  !"#$%&'()**++,,--./011223344556789:;;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijkl m n o p q r s t u v w x y z { | } ~        iteratee-0.8.4.2Data.Iteratee.IO.PosixData.Iteratee.Base.LooseMapData.NullPoint Data.Nullable Data.Iteratee.Base.ReadableChunkData.Iteratee.ExceptionData.Iteratee.BaseData.Iteratee.IterateeData.Iteratee.ListLikeData.Iteratee.CharData.Iteratee.BinaryData.Iteratee.IO.FdData.Iteratee.IO.HandleData.Iteratee.IOData.Iteratee.IO.InteractData.Iteratee.IO.BaseControl.Exceptionthrowmerge Control.Monadjoin mergeByChunksListgroupBy Data.IterateebaseSystem.Posix.Types FileOffsetForeign.C.ErrorErrnoLooseMaplMap NullPointemptyNullablenullC ReadableChunk readFromPtrmyfdReadmyfdSeekselect'read'pendingIterStringException EofException SeekException IterException IExceptiontoIterExceptionfromIterExceptionEnumUnhandledIterExceptionEnumStringExceptionDivergentException EnumException IFExceptionenStrExc wrapIterExciterExceptionToExceptioniterExceptionFromException iterStrExcIterateerunIter StreamStatusEofError EofNoError DataRemainingStreamChunkEOFsetEOFidoneicontliftIidoneMicontMruntryRun mapIterateeilift Enumerator EnumerateethrowErrthrowRecoverableErrcheckErridentityisStreamFinished skipToEofseek mapChunksM_ mapReducegetChunk getChunkseneeCheckIfDone mapChunks convStreamunfoldConvStreamjoinIjoinIM enumChunkenumEofenumErr>>>><><>< mergeEnumsenumPure1ChunkenumListenumCheckIfDoneenumFromCallbackenumFromCallbackCatch isFinished stream2list stream2streambreakheadlastheadspeekrolldrop dropWhilelength chunkLength takeFromChunkbreakEtaketakeUpTo mapStreamrigidMapStreamfiltergroupfoldlfoldl'foldl1foldl1'sumproductenumPairzipzip3zip4zip5enumWith sequence_enumPureNChunkmapM_foldM printLinesprintLinesUnterminated enumLines enumWords enumWordsBS enumLinesBSEndianLSBMSB endianRead2 endianRead3 endianRead3i endianRead4enumFd enumFdCatch enumFdRandom fileDriverFdfileDriverRandomFdenumFileenumFileRandom enumHandleenumHandleCatchenumHandleRandomfileDriverHandlefileDriverRandomHandledefaultBufSize fileDriverfileDriverVBuffileDriverRandomfileDriverRandomVBufioIterGHC.Basemap$fLooseMap[]elel'$fNullPointByteString$fNullPointByteString0 $fNullPoint[]$fNullableByteString$fNullableByteString0 $fNullable[]GHC.PtrPtr$fReadableChunkByteStringWord8$fReadableChunkByteStringWord80$fReadableChunk[]Word$fReadableChunk[]Word32$fReadableChunk[]Word16$fReadableChunk[]Word8$fReadableChunk[]Char GHC.Exception toException$fIExceptionIterStringException$fExceptionIterStringException$fIExceptionEofException$fExceptionEofException$fIExceptionSeekException$fExceptionSeekException$fIExceptionIterException$fExceptionIterException$fShowIterException%$fExceptionEnumUnhandledIterException$fExceptionEnumStringException$fExceptionDivergentException$fExceptionEnumException$fShowEnumException$fExceptionIFException$fShowIFException$fFunctorStream$fMonadCatchIOIteratee$fMonadIOIteratee$fMonadTransIteratee$fMonadIteratee$fApplicativeIteratee$fFunctorIteratee$fMonoidStream $fEqStream$fIExceptionNotAnException$fExceptionNotAnException