úÎD®BP*      !"#$%&'()portablejmillikin@gmail.com&KIn cases where an enumerator acts as both a source and sink, the resulting  type is named an $. Enumeratees have two input types,   outer a  (aOut) and  inner a  (aIn). While /s consume data, enumerators generate it. Since   is an alias for m ( e a m b), s can ) be considered step transformers of type   e a m b -> m ( e a m b). :s typically read from an external source (parser, handle, 2 random generator, etc). They feed chunks into an  until the % source runs out of data (triggering  ) or the iteratee finishes  processing ( s a value). 7The primary data type for this library, which consumes  input from a  1 until it either generates a value or encounters E an error. Rather than requiring all input at once, an iteratee will  return - when it is capable of processing more data. #In general, iteratees begin in the  state. As each chunk is A passed to the continuation, the iteratee returns the next step:   for more data,  when it's finished, or  to  abort processing. The 8 encountered an error which prevents it from proceeding / further. The type of error will depend on the  and/or   -- common choices are * and +,. The 1 has received enough input to generate a result. C Included in this value is left-over input, which can be passed to  composed s. The : is capable of accepting more input. Note that more input " is not necessarily required; the  might be able to generate a " value immediately if it receives  . 'Not to be confused with types from the Stream or   stream-fusion packages, a   is a sequence of chunks  generated by an . In contrast to Oleg s implementation, C this stream does not support error handling -- errors encountered / while generating a stream are reported in the  type instead.  (Chunks [])8 is used to indicate that a stream is still active, but H currently has no available data. Iteratees should ignore empty chunks.  returnI x = Iteratee (return x)  'yield x chunk = returnI (Yield x chunk) !continue k = returnI (Continue k) $throwError err = returnI (Error err)  liftI f = continue (returnI . f) Equivalent to (>>=), but allows s with different input types  to be composed.  (==<< ) = flip (>>==)Consume all input until  (, then return consumed input as a list. Return - if the next   is  . ,The most primitive enumerator; simply sends  . The iteratee must = either yield a value or throw an error continuing receiving   will & not terminate with any useful value. FAnother small, useful enumerator separates an input list into chunks, N and sends them to the iteratee. This is useful for testing iteratees in pure  code. Compose a list of s using '(>>==)'  is used to  flatten   s into an  . A common pattern in % implementations is to check whether  the inner 0 has finished, and if so, to return its output.  , passes its parameter a continuation if the  / can still consume input, or yields otherwise.  !"#  break p = " (not . p)$ERun an iteratee until it finishes, and return either the final value 0 (if it succeeded) or the error (if it failed). %Print chunks as they',re received from the enumerator, optionally  printing empty chunks. &  !"#$%&   !"#$%&   !"#$%portablejmillikin@gmail.com&ERead bytes (in chunks of the given buffer size) from the handle, and  stream them to an ). If an exception occurs during file IO,  enumeration will stop and ' will be returned. Exceptions from the  iteratee are not caught.  Buffer size ';Opens a file path in binary mode, and passes the handle to &. " The file will be closed when the  finishes. (ERead bytes from a stream and write them to a handle. If an exception 2 occurs during file IO, enumeration will stop and  will be  returned. );Opens a file path in binary mode, and passes the handle to (. " The file will be closed when the  finishes. &'()&')(&'().      !"#$%&'()*+,-.,/0,/01234enumerator-0.1Data.EnumeratorData.Enumerator.IO Enumeratee EnumeratorIteratee runIterateeStepErrorYieldContinueStreamEOFChunksreturnIyieldcontinue throwErrorliftI>>====<<consumeisEOFenumEOFenumList concatEnumsjoinI checkDonemapsequenceheadpeeklastlengthdrop dropWhilespanbreakrun printChunks enumHandleenumFile iterHandleiterFilebaseGHC.BaseString GHC.Exception SomeExceptionghc-primGHC.BoolTrue