úÎhÂGÿŠ      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ                !"# $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ 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 [ \ ] ^ _ ` 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 { | } ~  €  ‚ ƒ „ … † ‡ ˆ ‰  <Š‹ŒŽ‘ ’“” •–—˜™AUse this value for zlib format. Add 16 for gzip format. Negate ? for raw zlib format. When uncompressing, add 32 to determine  zlib/gzip format automatically. š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸<Š‹ŒŽ‘ ’“” •–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸<Š‹ŒŽ‘ ’’“”” ••–——˜™™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸RException thrown by CtlI& when the type of the control request / is not supported by the enclosing enumerator. An IterR0 is the result of feeding a chunk of data to an /..  An IterR9 is in one of several states: it may require more input  ( 1), it may wish to execute monadic actions in the  transformed monad ((), it may have a control request for an  enclosing enumerator (!), it may have produced a result  (), or it may have failed (). The /.' failed. If it was an enumerator, the  target /.! that the enumerator was feeding 2 likely has not failed, in which case its current  state is returned in the Maybe a. If it makes 1 sense to preserve the state of the input stream - (which it does for most errors except parse 0 errors), then the third parameter includes the  residual 21 at the time of the failure. #Sufficient input was received; the /. is  returning a result of type a. In adition, the   has a 21 containing any residual . input that was not consumed in producing the  result. A control request (see ('). 0The iteratee must execute monadic bind in monad m "The iteratee requires more input. !$Contains information about a failed /.. Failures of type  & must be caught by E (or F , etc.). E However, any other type of failure is considered a parse error, and  will be caught by N, O, and ¹. "What you get from º. Useful if you don't 4 want to specify any information about the failure. #%A miscellaneous parse error occured. $0An EOF error occurred, either in some IO action  wrapped by » , or in some /. that called  C. %List of (input_seen, input_expected) pairs. &3An actual error occured that is not a parse error,  EOF, etc. ' Used when an /.. is issuing a control request to an enclosing  enumerator. Note that unlike   or , control requests E expose the residual data, which is ordinarily fed right back to the B continuation upon execution of the request. This allows certain @ control operations (such as seek and tell) to flush, check the ) length of, or adjust the residual data. ()The outcome of an  request. *%The result of the control operation. +3The request was supported, and executing it caused  an exception to be thrown. ,6The request type was not supported by the enumerator. -@Class of control commands for enclosing enumerators. The class ; binds each control argument type to a unique result type. .The basic Iteratee type is  Iter t m a, where t is the type of  input (in class 3), m" is a monad in which the iteratee  may execute actions (using the ¼ ½ method), and a % is the result type of the iteratee. Internally, an Iter is a function from an input 21 to a  result of type . /01Chunk is a wrapper around a 3 type that also includes  an EOF flag that is ¾ if the data is followed by an  end-of-file condition. An /. that receives a Chunk with EOF  ¾= must return a result (or failure); it is an error to demand  more data (return  ) after an EOF. 23 ChunkData5 is the class of data types that can be output by an 1 enumerator and iterated on with an iteratee. A  ChunkData type  must be a ¿-, but must additionally provide a predicate,  null,, for testing whether an object is equal to À.  Feeding a null2 chunk to an iteratee followed by any other chunk C should have the same effect as just feeding the second chunk. To = simplify debugging, there is an additional requirement that   ChunkData% be convertable to a String with the  chunkShow method. Note that because the Prelude contains a function Á 0 for lists, you may wish to include the import:  import Prelude hiding (null) 456?Constructor function that builds a chunk containing data and a   EOF flag. 7An chunk with À data and the EOF flag ¾. 8 Builds an /.1 that keeps requesting input until it receives a  non-4 21. In other words, the 21 fed to the C argument function is guaranteed either to contain data or to have  the EOF flag true (or both). 9 True if an ! is requesting something from an  enumerator--i.e., the  is not  or . :Show the current state of an , prepending it to some  remaining input (the standard à optimization), when a is in  class Ä. Note that if a is not in Ä, you can simply  use the Å function. ;Show the current state of an /. if type a is in the Ä 5 class. (Otherwise, you can simply use the ordinary Æ  function.) Ç<fmapI is like È(, but differs in one important respect: > it preserves the failed result of an enumerator (and in fact / applies the function to the non-failed target /. state). By  contrast, È, which is equivalent to È f i = i É  Ê . f, transforms the Ë a component of all   states to Ì because of its use of É. =Maps the result of an  like Í, but only if the  < is no longer active. It is an error to call this function  on an  in the  , , or  state. Because  of this restriction, fmapR' does not require the input and output  Î types (m1 and m2) to be the same. ÏThis is a generalization of fixIO for arbitrary members of the  Ð class. >Feed an EOF to an /.# and return the result. Throws an ( exception if there has been a failure. ?The equivalent for @ for s. @Runs an /. from within a different /. monad. If  successful,  runI iter! will produce the same result as ½  (> iter). However, if iter fails, > throws a ? language-level exception, which cannot be caught within other  /. monads. By contrast, runI! throws a monadic exception that  can be caught. In short, use runI in preference to run in < situations where both are applicable. See a more detailed E discussion of the same issue with examples in the documentation for  .|$ in Data.IterIO.Inum. AMake an $ from a String. B<Throw an exception from an Iteratee. The exception will be C propagated properly through nested Iteratees, which will allow it D to be categorized properly and avoid situations in which resources B such as file handles are not released. (Most iteratee code does  not assume the Monad parameter m is in the Ð class, and  hence cannot use Ñ or  onException to clean up after  exceptions.) Use B in preference to Ò whenever  possible.  Do not use throwI+ to throw parse errors or EOF errors. Use  C and D$ instead. For performance reasons,  the !1 type segregates EOF and parse errors from other  types of failures. CThrow an exception of type IterEOF. This will be interpreted  by mkInum7 as an end of file chunk when thrown by the codec. It  will also be interpreted by O and N as parsing $ failure. If not caught within the /. monad, the exception will  be rethrown by > (and hence |$) as an Ó of type EOF. D@Throw a miscellaneous parse error (after which input is assumed C to be unsynchronized and thus is discarded). Parse errors may be  caught as exception type !, but they can also be caught # more efficiently by the functions N, O, and  ¹. ÔRun an /.1. Catch any exception it throws (and return the E failing iter state). Transform successful results with a function. ,This function is slightly more general than E. For  instance, we can' t implement F in terms of just E.  Something like  2 tryI iter = catchI (iter >>= return . Right) ... #would remove the possibly unfailed /. state from failed Inum  results, because the É& operator has this effect. (I.e., if  iter is  e (Õ i) c, the expression iter >>= return  . Right will be  e Nothing c.) This could be particularly B bad in cases where the exception is not even of a type caught by  the F expression. Similarly, trying to implement E in terms of F doesn't  quite work. Something like  E catchI iter handler = tryI iter >>= either (uncurry handler) return would erase state from Inum failures not caught by the handler. /. that might throw an exception Exception handler #Conversion function for result and InumFail errors. E Catch an exception thrown by an /., including exceptions  thrown by any Inums fused to the /. (or applied to it with  .|$3). If you wish to catch just errors thrown within Inums,  see the function  inumCatch in Data.IterIO.Inum. On exceptions, catchI' invokes a handler passing it both the / exception thrown and the state of the failing  , which may C contain more information than just the exception. In particular,  if the exception occured in an Inum, the returned  will  also contain the  being fed by that Inum, which likely D will not have failed. To avoid discarding this extra information, ) you should not re-throw exceptions with B. Rather, you 9 should re-throw an exception by re-executing the failed   with c). For example, a possible definition of  K is:    onExceptionI iter cleanup =  iter `catchI` \(Ö× _) r -> cleanup >> c r  Note that catchI only works for  synchronous exceptions, such as  IO errors (thrown within » blocks), the monadic Ø % operation, and exceptions raised by B. It is not possible  to catch  asynchronous& exceptions, such as lazily evaluated  divide-by-zero errors, the Ò function, or exceptions raised  by other threads using throwTo" if those exceptions might arrive  anywhere outside of a » call. `catchI`# has the default infix precedence ( infixl 9  `catchI`6), which binds more tightly than any concatenation or  fusing operators. /. that might throw an exception 4Exception handler, which gets as arguments both the  exception and the failing /. state. FIf an /. succeeds and returns a , returns Ù a. If  the /. fails and throws an exception e (of type e ), returns  Ú (e, r) where r is the state of the failing /.. G A version of F* that catches all exceptions. Instead of 8 returning the exception caught, it returns the failing  C (from which you can extract the exception if you really want it). A The main use of this is for doing some kind of clean-up action, % then re-throwing the exception with c. ;For example, the following is a possible implementation of J:  finallyI iter cleanup = do  er <- tryRI iter  cleanup  either reRunIter return er H A variant of F( that just catches EOF errors. Returns  Ì after an EOF error, and Õ the result otherwise. A Should be much faster than trying to catch an EOF error of type  Û. I A varient of F that returns the ! state rather than ) trying to match a particular exception. J Execute an /.., then perform a cleanup action regardless of  whether the /.. threw an exception or not. Analogous to the  standard library function finally. K Execute an /.% and perform a cleanup action if the /. A threw an exception. Analogous to the standard library function   onException. L Simlar to F., but saves all data that has been fed to the  /., and rewinds the input if the /. fails. (The B in  tryBI stands for " backtracking" .) Thus, if tryBI returns  Ú exception , the next /.! to be invoked will see the same  input that caused the previous /. to fail. (For this reason,  it makes no sense ever to call resumeI on the /. you get  back from tryBI, which is why tryBI does not return the failing  Iteratee the way F does.) Because tryBI4 saves a copy of all input, it can consume a lot of ) memory and should only be used when the /. argument is known to # consume a bounded amount of data. M A variant of L* that, also rewinds input on failure, but  returns the raw !( structure, rather than mapping it to a C particular exception. This is much faster because it requires no 8 dynamic casts. However, the same warning applies that tryFBI  should not be applied to /.#s that could take unbounded input. Ü;Run an Iteratee, and if it throws a parse error by calling   expectedI4, then combine the exptected tokens with those of a  previous parse error. Previous parse error Result of second /.--if it fails the error ) should be combined with the first error N@Try two Iteratees and return the result of executing the second * if the first one throws a parse, EOF, or º error. Note that  Data.IterIO.Parse defines <|> as an infix synonym for this  function. The statement multiParse a b is similar to O a return  b?, but the two functions operate differently. Depending on the = situation, only one of the two formulations may be correct.  Specifically:  O a f b works by first executing a, saving a copy of  all input consumed by a. If a throws a parse error, the 1 saved input is used to backtrack and execute b on the same  input that a just rejected. If a succeeds, b is never  run; a's result is fed to f, and the resulting action is > executed without backtracking (so any error thrown within f  will not be caught by this O expression).  Instead of saving input, multiParse a b executes both a and  b* concurrently as input chunks arrive. If a throws a parse ( error, then the result of executing b is returned. If a ? either succeeds or throws an exception that is not a parse  errorEOFº, then the result of running a is returned.  With multiParse a b, if b returns a value, executes a  monadic action via ½", or issues a control request via  [, then further processing of b will be suspended until  a: experiences a parse error, and thus the behavior will be  equivalent to O a return b. The main restriction on O is that a must not consume ? unbounded amounts of input, or the program may exhaust memory C saving the input for backtracking. Note that the second argument  to O (i.e., Ê in ifParse a return b) is a  continuation for a when a succeeds. The advantage of  multiParse is that it can avoid storing > unbounded amounts of input for backtracking purposes if both  /.>s consume data. Another advantage is that with an expression  such as O a f b*, sometimes it is not convenient to break ? the parse target into an action to execute with backtracking (a) 5 and a continuation to execute without backtracking (f). The  equivalent multiParse (a >>= f) b avoids the need to do this, $ since it does not do backtracking. BHowever, it is important to note that it is still possible to end , up storing unbounded amounts of input with  multiParse. For ' example, consider the following code:  ) total :: (Monad m) => Iter String m Int > total = multiParse parseAndSumIntegerList (return -1) -- Bad Here the intent is for parseAndSumIntegerList to parse a E (possibly huge) list of integers and return their sum. If there is = a parse error at any point in the input, then the result is  identical to having defined total = return -1. But  return -1 < succeeds immediately, consuming no input, which means that total < must return all left-over input for the next action (i.e., next  in total >>= next ). Since total has to look arbitrarily far " into the input to determine that parseAndSumIntegerList fails, in  practice total1 will have to save all input until it knows that  parseAndSumIntegerList succeeds. A better approach might be:   . total = multiParse parseAndSumIntegerList (Q >> return -1) Here Q4 discards all input until an EOF is encountered, so B there is no need to keep a copy of the input around. This makes  sense so long as total) is the last or only Iteratee run on the  input stream. (Otherwise, Q would have to be replaced with A an Iteratee that discards input up to some end-of-list marker.) DAnother approach might be to avoid parsing combinators entirely and  use:   " total = parseAndSumIntegerList `E` handler  where handler ( IterNoParse _) _ = return -1 This last definition of total may leave the input in some 4 partially consumed state. This is fine so long as total is the  last /.2 executed on the input stream. Otherwise, before  throwing the parse error, parseAndSumIntegerList would need to D ensure the input is at some reasonable boundary point for whatever  comes next. (The Y( function is sometimes helpful for this  purpose.) OifParse iter success failure runs iter, but saves a copy of  all input consumed using M. (This means iter must not * consume unbounded amounts of input! See N for such  cases.) If iter0 succeeds, its result is passed to the function  success. If iter throws a parse error (with D),  throws an EOF error (with C), or executes º, then  failure. is executed with the input re-wound (so that failure is  fed the same input that iter was). If iter throws any other  type of exception, ifParse( passes the exception back and does not  execute failure. See Data.IterIO.Parse+ for a discussion of this function and the  related infix operator \/ (which is a synonym for P).  Iteratee iter to run with backtracking success function failure action result P ifNoParse is just O% with the second and third arguments  reversed. QSinks data like /dev/null , returning () on EOF. R?Returns a non-empty amount of input data if there is any input  left. Returns À on an EOF condition. SLike R0, but always returns non-empty data. Throws an  exception on an EOF condition. T A variant of R- that reads the whole input up to an EOF and  returns it. UReturns the next 21 that either contains non-4 data or  has the EOF bit set. VKeep running an /. until either its output is not 4 or & we have reached EOF. Return the the /.'s value on the last  (i.e., usually non-4 ) iteration. WRuns an /.2 then rewinds the input state, so that the effect # is to parse lookahead data. (See L if you want to rewind the  input only when the /. fails.) X1Does not actually consume any input, but returns ¾ if there " is no more input data to be had. YAPlace data back onto the input stream, where it will be the next  data consumed by subsequent /.s. Z"Issue a control request. Returns , if the request type % is unsupported. Otherwise, returns * with the result if ! the request succeeds, or return + if the request type is ; supported but attempting to execute the request caused an  exception. [:Issue a control request and return the result. Throws an  exception of type  if the operation type was not ' supported by an enclosing enumerator. \ A variant of ] that only works for the   and   states, not the % state. (Because of this additional # restriction, the input and output Î types m1 and m2 do  not need to be the same.) The  that needs to be stepped. Transformation function if the  is in the    or  state. Fallback if the  is no longer active. ]Step an active  (i.e., one in the  , , or  9 state) to its next state, and pass the result through a  function. The /. that needs to be stepped Function to pass the /. to after stepping it. Fallback if the /. can no longer be stepped ^The equivalent of _ for s. _Run an /. until it enters the  or  state, then ! use a function to transform the . ÝLike _5, but also keeps a copy of all input consumed. (The  residual input on the " returned will be a suffix of the  input returned.) `Get the residual data for an  that is in no longer active  or that is in the & state. (It is an error to call this  function on an  in the   or  state.) aSet residual data for an  that is not active. (It is an  error to call this on an  in the , , or   states.) bFeed more input to an /.& that has already been run (and hence  is already an ). In the event that the  is ( requesting more input (i.e., is in the   state), this is $ straight forward. However, if the /. is in some other state  such as 3, this function needs to save the input until such  time as the ' is stepped to a new state (e.g., with ]  or c). cTurn an  back into an /.. ÞThe /. instance of Ð handles errors specially. If + the lifted operation throws an exception, » catches the  exception and returns it as an ! failure. If the  exception is an Ó satisfying ß , then the  exception is wrapped in the $ constructor; otherwise, it  is wrapped in &" otherwise. This approach allows A efficient testing for EOF errors without the need to invoke the  expensive à or á operations. (Yes liftIO uses ! these expensive operations, but /.s that invoke C do  not.) 8One consequence of this exception handling is that with /., & unlike with most monad transformers, » is not equivalent # to some number of nested calls to ½. See the documentation of  .|$ for an example. âA 21 is 4 when its data is 4 and its EOF flag is  Â. K !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcK3451267./0-),+*'(!&%$#" 89:;>@ABCDEFIGHJKLMOPNQRSTUVWXYZ[_<^]\?=cb`aK  !&%$#""#$%&'((),+**+,-./0/0122345456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcd IterStateT is a variant of the ãä monad transformer & specifically designed for use inside /.s. The ed  Monad itself is the same as ãä. However, the f ! function works differently from å--it returns an  E and the result state separately. The advantage of this approach is D that you can still recover the state at the point of the excaption  even after an ! or InumFail condition. efRuns an ed s m computation on some state s.  Returns the result ( ) of the /. and the state of s as 3 a pair. Pulls residual input up to the enclosing /. monad (as  with  pullupResid in Data.IterIO.Inum). gReturns the state in an /. t (ed s m) monad.  Analogous to æ for a ãä s m monad. h"Returns a particular field of the ed state, analogous  to ç for ãä. i Sets the ed state. Analogous to è for  ãä. j Modifies the ed state. Analogous to é for  ãä. k Adapt an /.2 from one monad to another. This function is the B lowest-level monad adapter function, upon which all of the other  adapters are built.  adaptIter requires two functions as E arguments. One adapts the result to a new type (if required). The A second adapts monadic computations from one monad to the other.  For example, m could be implemented as:    liftI :: (¼ t, Monad m, Monad (t m), 3 s) =>  /. s m a -> /. s (t m) a  liftI = adaptIter ê (\m -> ½ (½ m) >>= liftI) Here ½ (½ m) executes a computation m of type m  (/. s m a) from within the /. s (t m) monad. The  result, of type /. s m a, can then be fed back into  liftI recursively. BNote that in general a computation adapters must invoke the outer  adapter function recursively.  adaptIter is designed this way E because the result adapter function may need to change. An example  is u), which could be implemented as follows:  ) runStateTI :: (ChunkData t, Monad m) => = Iter t (StateT s m) a -> s -> Iter t m (a, s) A runStateTI iter s = adaptIter adaptResult adaptComputation iter " where adaptResult a = (a, s) D adaptComputation m = do (r', s') <- lift (runStateT m s) 4 runStateTI r' s' Here, after executing å, the state may be modified.  Thus, adaptComputation invokes  runStateTI recursively with the  modified state, s', to ensure that subsequent  C computations will be run on the latest state, and that eventually   adaptResult will pair the result a with the newest state. How to adapt result values How to adapt computations Input computation Output computation l)Simplified adapter function to translate /. computations from 2 one monad to another. This only works on monads m for which  running m a returns a result of type a. For more complex  scenarios (such as ëì or ãä), you need to use the more  general k. As an example, the n% function is implemented as follows:   liftIterIO :: (ChunkData t, Ð! m) => Iter t IO a -> Iter t m a  liftIterIO = adaptIterM » Conversion function /. of input monad Returns /. of output monad mRun an /. s m computation from witin the /. s (t m)  monad, where t is a ¼. nRun an /. t IO computation from within an /. t m  monad where m is in class Ð. í;The type signature says it all. Just a slightly optimized  version of joinlift = join . lift. oTurn a computation of type /. t (îï (/. t m a) m)  a into one of type /. t m a . Note the continuation has to  return type /. t m a and not a so that runContTI can call  itself recursively. pRun a computation of type /. t (ðñ e m) from within  the /. t m1 monad. This function is here for completeness,  but please consider using B instead, since the /. monad / already has built-in exception handling and it's best to have a . single, uniform approach to error reporting. qRun an /. t (ëì m) computation from within the /.  t m monad. rRun an /. t (òó r m) computation from within the  /. t m monad. sRun an /. t (ôõ r w s m) computation from within the  /. t m monad. Computation to transform  Reader State Mutable State &Returns result, mutable state, writer tRun an /. t (ö÷ r w s m) computation from within  the /. t m monad. Just like s, execpt this function  is for Lazy ö÷ rather than strict ôõ. Computation to transform  Reader State Mutable State &Returns result, mutable state, writer uRun an /. t (ãä m) computation from within the  /. t m monad. vRun an /. t (øù m) computation from within the  /. t m monad. Just like u, except this function  works on Lazy øù rather than strict ãä. wRun an /. t (úû w m) computation from within the  /. t m monad. xRun an /. t (üý w m) computation from within  the /. t m monad. This is the same as þ but for  the Lazy üý, rather than the strict one. ÿdefghijklmnopqrstuvwxmnopqrstuvwxkldefghijdeefghijklmnopqrstuvwx>y-A monad in which to define the actions of an } tIn tOut m  a. Note InumM tIn tOut m a is a Î of kind * -> *, where  a6 is the (almost always parametric) return type of the }. A B fifth type argument is required for monadic computations of kind  *, e.g.:  ! seven :: InumM tIn tOut m a Int  seven = return 7 *Another important thing to note about the y monad, as $ described in the documentation for ¡, is that you must call  ½# twice to execute actions in monad m, and you must use  the m& function to execute actions in monad /. t m a.  Internal data structure for the y monad' s state. z+A control handler maps control requests to  results.  Generally the type parameter m1 is /. t' m. {A  ResidHandler- specifies how to handle residual data in an  }. Typically, when an } finishes executing, there are ) two kinds of residual data. First, the } itself (in its role B as an iteratee) may have left some unconsumed data. Second, the  target /. being fed by the } may have some resitual data, . and this data may be of a different type. A  ResidHandler allows A this residual data to be adjusted by untranslating the residual  data of the target /.' and sticking the result back into the  }'s residual data. The two most common  ResidHandlers are ” (to pull the  target /.'s residual data back up to the } as is), and  ê) (to do no adjustment of residual data).  ResidHandlers are used by the ‘ function, and by the  Š z. |An  Onum t m a is just an } in which the input is  ()--i.e., } () t m a'--so that there is no meaningful input 5 data to transcode. Such an enumerator is called an  outer enumerator/, because it must produce the data it feeds to  /.'s by either executing actions in monad m, or from its own  internal pure state (as for ™). As with }s, an Onum) should under no circumstances ever feed % a chunk with the EOF bit set to its /. argument. When the  Onum> runs out of data, it must simply return the current state of  the /.7. This way more data from another source can still be C fed to the iteratee, as happens when enumerators are concatenated  with the € function. Onum,s should generally be constructed using the ’ or  ¡ function, just like }s, the only difference being  that for an Onum the input type is (), so executing /.s to & consume input will be of little use. }The type of an iterator-enumerator, which transcodes data from  some input type tIn to some output type tOut. An Inum acts  as an /.6 when consuming data, then acts as an enumerator when $ feeding transcoded data to another /.. %At a high level, one can think of an Inum as a function from  /.s to  s, where an Inum's input and output types are . different. A simpler-seeming alternative to Inum might have  been:  9 type Inum' tIn tOut m a = Iter tOut m a -> Iter tIn m a In fact, given an Inum object inum, it is possible to construct  a function of type Inum' with (inum ƒ). But sometimes one  might like to concatenate Inums. For instance, consider a ? network protocol that changes encryption or compression modes $ midstream. Transcoding is done by Inums. To change transcoding  methods after applying an Inum to an iteratee requires the  ability to "pop" the iteratee back out of the Inum so as to be  able to hand it to another Inum. Inum's return type ( Iter tIn  m (IterR tOut m a) as opposed to  Iter tIn m a ) allows the  monadic bind operator É to accomplish this popping in  conjunction with the G and c functions. All Inum%s must obey the following two rules.   An Inum /may never feed a chunk with the EOF flag set to   it's target /.#. Instead, upon receiving EOF, the Inum 0 should simply return the state of the inner /. (this is how  "popping"% the iteratee back out works--If the Inum passed  the EOF through to the /., the /. would stop requesting 4 more input and could not be handed off to a new Inum).  An Inum *must always return the state of its target /..  This is true even when the Inum fails, and is why the   state contains a Ë a field. >In addition to returning when it receives an EOF or fails, an  Inum should return when the target /. returns a result or  fails. An Inum/ may also unilaterally return the state of the D iteratee at any earlier point, for instance if it has reached some B logical message boundary (e.g., many protocols finish processing % headers upon reading a blank line). Inum,s are generally constructed with one of the ’ or  ¡: functions, which hide most of the error handling details . and ensure the above rules are obeyed. Most Inums are  polymorphic in the last type, a", in order to work with iteratees  returning any type. ~Run an | on an /.$. This is the main way of actually  executing IO with /.s. |$! is a type-restricted version of  the following code, in which inum must be an |:   inum |$ iter = > (inum .| iter)  infixr 2 |$ .|$ is a variant of ~ that allows you to apply an |  from within an /., monad. This is often useful in conjuction  with ™2, if you want to parse at some coarse-granularity 9 (such as lines), and then re-parse the contents of some + coarser-grained parse unit. For example:   rawcommand <- lineI 6 command <- enumPure rawcommand .|$ parseCommandI ; return Request { cmd = command, rawcmd = rawcommand } .|$ has the same fixity as |$ , namely:   infixr 2 .|$ 'Note the important distinction between (.|$) and (ƒ).  (.|$) runs an |- and does not touch the current input, while  (ƒ%) pipes the current input through an }. For instance, to C send the contents of a file to standard output (regardless of the  current input), you must say enumFile " .signature" .|$  stdoutI8. But to take the current input, compress it, and send - the result to standard output, you must use ƒ, as in inumGzip  ƒ stdoutI. As suggested by the types,  enum .|$ iter is sort of equivalent to  ½ (enum |$ iter)#, except that the latter will call throw ? on failures, causing language-level exceptions that cannot be  caught within the outer /.. Thus, it is better to use .|$  than ½ (... ~ ...)%, though in the less general case of  the IO monad,  enum .|$ iter is equivalent to » (enum ~  iter)+ as illustrated by the following examples: H -- Catches exception, because .|$ propagates failure through the outer . -- Iter Monad, where it can still be caught.  apply1 :: IO String 4 apply1 = enumPure "test1" |$ iter `catchI` handler  where 0 iter = enumPure "test2" .|$ fail "error" ; handler (SomeException _) _ = return "caught error"  F -- Does not catch error. |$ turns the Iter failure into a language- ? -- level exception, which can only be caught in the IO Monad.  apply2 :: IO String 4 apply2 = enumPure "test1" |$ iter `catchI` handler  where 6 iter = lift (enumPure "test2" |$ fail "error") ; handler (SomeException _) _ = return "caught error"  H -- Catches the exception, because liftIO uses the IO catch function to D -- turn language-level exceptions into monadic Iter failures. (By E -- contrast, lift works in any Monad, so cannot do this in apply2.) C -- This example illustrates how liftIO is not equivalent to lift.  apply3 :: IO String 4 apply3 = enumPure "test1" |$ iter `catchI` handler  where 8 iter = liftIO (enumPure "test2" |$ fail "error") ; handler (SomeException _) _ = return "caught error" €:Concatenate the outputs of two enumerators. For example,  enumFile "file1" `cat` enumFile "file2" produces an  |) that outputs the concatenation of files "file1" and  "file2". Unless the first } fails, cat always invokes the  second }, as the second } may have monadic side-effects % that must be executed even when the /. has already finished.  See  if you want to stop when the /. no longer requires C input. If you want to continue executing even in the event of an  InumFail# condition, you can wrap the first } with  „ and invoke ‡$ from within the exception handler. cat (and ., described below) are useful in right folds.  Say, for instance, that files is a list of files you wish to 0 concatenate. You can use a construct such as:    catFiles :: (Ð m) => [] -> |  L.ByteString m a  catFiles files =   (€ . enumFile) — files Note the use of — as the starting value for  . This  is not to be confused with –. — acts as a no-op 8 for concatentation, producing no output analogously to  /dev/null. By contrast – is the no-op for fusing (see  ‚ and ƒ6 below) because it passes all data through untouched. cat has fixity:  infixr 3 `cat` Lazy cat. Like €), except that it does not run the second  } if the /.- is no longer active after completion of the  first }. Also has fixity  infixr 3 `lcat`.  Transforms the result of an } into the result of the /.  that it contains. Used by ‚ and ƒ to collapse their result  types. .Note that because the input type if the inner /., tMid, gets " squeezed out of the return type, joinR will feed an EOF to the  inner /.3 if it is still active. This is what ensures that  active /.$s end up seeing an EOF, even though } s themselves 5 are never supposed to feed an EOF to the underlying /.. All  /.s in right-hand arguments of ƒ and ‚ get fed an EOF by  joinR (if they don',t finish on their own), while the outermost  } is fed an iter by the > function (or by ~ which  invokes > internally). ‚+Left-associative pipe operator. Fuses two } s when the  output type of the first }" is the same as the input type of $ the second. More specifically, if inum1 transcodes type tIn to  tOut and inum2 transcodes tOut to tOut2, then inum1  |. inum2 produces a new } that transcodes from tIn to  tOut2. Typically types i and iR are /. tOut2 m a and   tOut2 m a6, respectively, in which case the second argument and  result of |. are also }s.  This function is equivalent to:    outer |. inner = \iter -> outer ƒ inner iter  infixl 4 |. 4But if you like point-free notation, think of it as outer |. inner  = (outer ƒ ) . inner, or better yet (|.) = (.) . (ƒ). ƒ+Right-associative pipe operator. Fuses an } that transcodes  tIn to tOut with an /. taking input type tOut to produce  an /. taking input type tIn . If the /. is still active  when the }+ terminates (either normally or through an  exception), then .| sends it an EOF.  Has fixity:  infixr 4 .| „Catches errors thrown by an }, or a set of fused }s.  Note that only errors in } s that are lexically within the  scope of the argument to „ will be caught. For example:  3 inumBad :: (ChunkData t, Monad m) => Inum t t m a # inumBad = mkInum $ fail "inumBad"  , skipError :: (ChunkData tIn, MonadIO m) =>  SomeException + -> IterR tIn m (IterR tOut m a) * -> Iter tIn m (IterR tOut m a)  skipError e iter = do < liftIO $ hPutStrLn stderr $ "skipping error: " ++ show e  resumeI iter  H -- Throws an exception, because inumBad was fused outside the argument  -- to inumCatch.  test1 :: IO () C test1 = inumCatch (enumPure "test") skipError |. inumBad |$ nullI  B -- Does not throw an exception, because inumBad fused within the  -- argument to inumCatch.  test2 :: IO () C test2 = inumCatch (enumPure "test" |. inumBad) skipError |$ nullI  E -- Again no exception, because inumCatch is wrapped around inumBad.  test3 :: IO () A test3 = enumPure "test" |. inumCatch inumBad skipError |$ nullI  Note that ` inumCatch`# has the default infix precedence (infixl  9 ` inumcatch`3), which binds more tightly than any concatenation  or fusing operators.  As noted for E&, exception handlers receive both the ! exception thrown and the failed . Particularly in the case  of  inumCatch,, it is important to re-throw exceptions by  re-executing the failed /. with c, not passing the  exception itself to B!. That way, if the exception is  re-caught, ‡/ will continue to work properly. For example, @ to copy two files to standard output and ignore file not found @ errors but re-throw any other kind of error, you could use the  following:   resumeTest :: IO ()  resumeTest = doFile "file1" `€` doFile "file2" |$ stdoutI  where ! doFile path = inumCatch ( enumFile' path) $ \ err r ->  if isDoesNotExistError err  then ˆ r  else c r } that might throw an exception Exception handler …$Execute some cleanup action when an } finishes. †"Execute some cleanup action if an } fails. Does not execute  the action if the /. (or some inner }) fails. Has the  same scoping rules as „. ‡'Used in an exception handler, after an } failure, to resume  processing of the /. by the next enumerator in a €ed  series. See „ for an example. ˆLike ‡ , but if the /. is resumable, also prints an 2 error message to standard error before resuming.  ‰Reject all control requests. Š3Pass all control requests through to the enclosing /. monad.  The {/ argument says how to adjust residual data, in  case some enclosing z decides to flush pending input C data, it is advisable to un-translate any data in the output type  tOut back to the input type tIn. ‹ Create a z* given a function of a particular control  argument type and a fallback z to run if the argument  type does not match. consCtl% is used to chain handlers, with the  rightmost handler being either ‰ or Š. AFor example, to create a control handler that implements seek on  SeekC+ requests, returns the size of the file on SizeC ; requests, and passes everything else out to the enclosing 3 enumerator (if any), you could use the following:   O fileCtl :: (ChunkData t, MonadIO m) => Handle -> CtlHandler (Iter () m) t m a  fileCtl h = ( $ (.SeekC mode pos) -> liftIO (hSeek h mode pos))  `consCtl` (Œ $ SizeC -> liftIO (hFileSize h))  `consCtl` Š ê  Has fixity:  infixr 9 `consCtl` ŒBMake a control function suitable for use as the first argument to  ‹. Like Œ6, except that it flushes all input and clears the EOF  flag in both /.. monads after executing the control function. ŽLike , but only for  --may return .  Run an /. just like 0, but then keep stepping the $ result for as long as it is in the  or  state (using  the supplied z for  states). } s should  generally use this function or Ž in preference to  0, as it is convenient if }s avoid ever returning   s in the  state.  Takes an } that might return  s in the  state $ (which is considered impolite--see ) and transforms it  into an } that never returns  s in the  state. ‘Create a stateless } from a "codec" /. that transcodes D the input type to the output type. The codec is invoked repeately 7 until one of the following occurs: The codec returns 4 data, 9 the codec throws an exception, or the underlying target /. is = no longer active. If the codec throws an exception of type  IterEOF9, this is considered normal termination and the error is  not further propagated. mkInumC: requires two other arguments before the codec. First, a  {1 allows residual data to be adjusted between the  input and output /. monads. Second, a z specifies a @ handler for control requests. For example, to pass up control 7 requests and ensure no residual data is lost when the } is  fused to an /., the  inumConcat function given previously for  ’ at  #mkInumExample could be re-written: A inumConcat :: (Monad m) => Inum [L.ByteString] L.ByteString m a 9 inumConcat = mkInumC reList (passCtl reList) iterConcat ) where reList (a, b) = (b:a, mempty) Adjust residual data (use ê for no adjustment) Handle control requests (use ‰ or Š if  } shouldn'-t implement any specific control functions).  Generate transcoded data chunks ’ Create an } based on an /. that transcodes the input to 3 the output type. This is a simplified version of ‘ that A rejects all control requests and does not adjust residual data.  mkInum = mkInumC id noCtl “A simplified version of ’" that passes all control requests * to enclosing enumerators. It requires a { to describe * how to adjust residual data. (E.g., use ” when tIn  and tOut are the same type.) ) mkInumP adj = mkInumC adj (passCtl adj) ”*pullupResid (a, b) = (mappend a b, mempty). See {. • Bracket an }- with a start and end function, which can be ? used to acquire and release a resource, must like the IO monad's  bracket function. For example: < enumFile :: (MonadIO m, ChunkData t, LL.ListLikeIO t e) => $ FilePath -> Onum t m a E enumFile path = inumBracket (liftIO $ openBinaryFile path ReadMode) / (liftIO . hClose) ( enumHandle Computation to run first Computation to run last Inum to bracket –inumNop+ passes all data through to the underlying /.. It % acts as a no-op when fused to other }s with ‚ or when fused  to /.s with ƒ. inumNop1 is particularly useful for conditionally fusing }s  together. Even though most } s are polymorphic in the return A type, this library does not use the Rank2Types extension, which  means any given }, must have a specific return type. Here is  an example of incorrect code:   $ let enum = if debug then base_enum ‚  inumStderr else base_enum -- Error  This doesn't work because  base_enum cannot have the same type as  (base_enum |. inumStderr)'. Instead, you can use the following:   let enum = base_enum ‚ if debug then  inumStderr else inumNop —inumNull$ feeds empty data to the underlying /. . It pretty 1 much acts as a no-op when concatenated to other }s with €  or . There may be cases where inumNull is required to avoid deadlock.  In an expression such as enum ~ iter, if enum immediately $ blocks waiting for some event, and iter immediately starts out C triggering that event before reading any input, then to break the ' deadlock you can re-write the code as cat inumNull enum ~  iter. ˜Feed pure data to an /.. ™Type-restricted version of ˜. š Repeat an }0 until the input receives an EOF condition, the  /." no longer requires input, or the /. is in an unhandled  : state (which presumably will continue to be unhandled by  the same }&, so no point in executing it again).  ›Set the control handler an } should use from within an  y computation. (The default is ‰.) œSet the AutoEOF flag within an y computation. If this  flag is ¾ , handle IterEOF exceptions like a normal but  immediate termination of the }. If this flag is   (the default), then IterEOF' exceptions must be manually caught or ! they will terminate the thread. Set the AutoDone flag within an y computation. When  ¾, the }+ will immediately terminate as soon as the  /.0 it is feeding enters a non-active state (i.e.,  or a " failure state). If this flag is  (the default), the  y5 computation will need to monitor the results of the  ¢, ¤, and ¥ functions to ensure the } 0 terminates when one of these functions returns Â. BLike imodify, but throws an error if the insCleaning flag is set. ž-Add a cleanup action to be executed when the } finishes, or, ! if used in conjunction with the Ÿ function, when the  innermost enclosing Ÿ action finishes. ŸRun an y2 with some cleanup action in effect. The cleanup A action specified will be executed when the main action returns, 8 whether normally, through an exception, because of the AutoDone  or AutoEOF flags, or because ¨ is invoked. Note  withCleanup0 also defines the scope of actions added by the  ž1 function. In other words, given a call such as  withCleanup cleaner1 main, if main invokes ž  cleaner2 , then both cleaner1 and cleaner2 will be executed  upon main's return, even if the overall } has not finished  yet. Cleanup action Main action to execute  Convert an y computation into an } , given some   to run on. !Monadic computation defining the }. State to run on   A variant of ¡ that sets AutoEOF and AutoDone to  ¾% by default. (Equivalent to calling œ ¾ >>   ¾ as the first thing inside ¡.) ¡ Build an } out of an y computation. If you run  ¡ inside the /. tIn m monad (i.e., to create an  enumerator of type } tIn tOut m a ), then the y ( computation will be in a Monad of type /. t tm where tm is  a transformed version of m. This has the following two  consequences: ) If you wish to execute actions in monad m from within your  y% computation, you will have to apply ½ twice (as  in ½ $ ½ action_in_m) rather than just once. ' If you need to execute actions in the /. t m monad, you $ will have to lift them with the m function. The y3 computation you construct can feed output of type  tOut to the target /.' (which is implicitly contained in the  monad state), using the ¢, ¤, and ¥ functions. ¢Used from within the y" monad to feed data to the target  /. . Returns  if the target /. is still active and  ¾" if the iter has finished and the } should also  return. (If the autoDone flag is ¾, then ifeed,  ipipe, and irun will never actually return ¾, but = instead just immediately run cleanup functions and exit the  } when the target /. stops being active.) £ A variant of ¢" that throws an exception of type IterEOF  if the data being fed is 4!. Convenient when reading input  with a function (such as  Data.ListLike's hget) that returns 0 E bytes instead of throwing an EOF exception to indicate end of file.  For instance, the main loop of enumFile could be implemented  as:   ¦ $ » (LL.hGet h defaultChunkSize) >>= £ ¤Apply another } to the target /. from within the y  monad. As with ¢ , returns ¾ when the /. is  finished. Note that the applied }( must handle all control requests. (In C other words, ones it passes on are not caught by whatever handler  is installed by › , but if the } returns the   in the  state, as ˜ does, then requests  will be handled.) ¥ Apply an | (or }( of an arbitrary, unused input type) to  the /. from within the y monad. As with ¢ , returns  ¾ when the /. is finished. ¦Repeats an action until the /. is done or an EOF error is E thrown. (Also stops if a different kind of exception is thrown, in ? which case the exception propagates further and may cause the  } to fail.) irepeat sets both the AutoEOF and  AutoDone flags to ¾. §If the target /. being fed by the } is no longer active  (i.e., if it is in the # state or in an error state), this , funciton pops the residual data out of the /. and returns it. . If the target is in any other state, returns À. ¨.Immediately perform a successful exit from an y monad,  terminating the }( and returning the current state of the  target /.. Can be used to end an ¦ loop. (Use  B ... for an unsuccessful exit.) 0yz{|}~€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨0}|~€‚ƒ„…†‡ˆ{z‘’“•”‰Š‹ŒŽ–—˜™šy¡ ›œžŸ¢£¤¥¦§¨0yz{|}~€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨ ©SendRecvString1 is the class of string-like objects that can be  used with datagram sockets. ª«¬­®Create a loopback (/., |) pair. The iteratee and E enumerator can be used in different threads. Any data fed into the  /. will in turn be fed by the | into whatever /. it A is given. This is useful for testing a protocol implementation  against itself. ¯ Returns an /.. that always returns itself until a result is  produced. You can fuse  inumSplit to an /. to produce an  /.$ that can safely be fed (e.g., with ™) from multiple  threads. °$Flushes a file handle and calls the shutdown system call so as E to write an EOF to a socket while still being able to read from it. C This is very important when the same file handle is being used to  to read data in an | and to write data in an /. . Proper & protocol functioning may require the /. to send an EOF (e.g., a  TCP FIN segment), but the | may still be reading from the  socket in a different thread. ±BFor debugging, print a tag along with the current residual input.  Not referentially transparent. ²@For debugging. Print the current thread ID and a message. Not  referentially transparent. ©ª«¬­®¯°±² ®¯©ª«¬­°±² ©ª«¬­ª«¬­®¯°±²-³#A control request that returns the  from an enclosing  socket enumerator. ´µ>A control command for determining the current offset within a E file. Note that this subtracts the size of the residual input data C from the offset in the file. Thus, it will only be accurate when 4 all left-over input data is from the current file. ¶·BA control command for seeking within a file, when a file is being / enumerated. Flushes the residual input data. ¸¹A control command (issued with [ SizeC) requesting the , size of the current file being enumerated. º»AAn Iteratee that puts data to a consumer function, then calls an  eof function. For instance, Æ could be defined as:   handleI :: (MonadIO m) =>  -> /.  m ()  handleI h = putI (» .  h) (» $ ° h 1) ¼ASend datagrams using a supplied function. The datagrams are fed B as a list of packets, where each element of the list should be a / separate datagram. For example, to create an /. from a  connected UDP socket:   udpI :: (© s, Ð m) =>  -> /. s m ()  udpI sock = sendI $ » . « sock ½@Return the first element when the Iteratee data type is a list. ¾Return Õ/ the first element when the Iteratee data type  is a list, or Ì on EOF. ¿Like ½, but works for any  data type. ÀLike ¾, but works for any  data type. ÁLike Â, but returns Ì on EOF. ÂReturn a line delimited by \r, \n, or \r\n. ÃReturn - data that is at most the number of elements B specified by the first argument, and at least one element unless ? EOF is encountered or 0 elements are requested, in which case  À is returned. ÄReturn - data that is at most the number of elements D specified by the first argument, and at least one element (as long ? as a positive number is requested). Throws an exception if a B positive number of items is requested and an EOF is encountered. ÅReturn the next len elements of a  data stream, D unless an EOF is encountered, in which case fewer may be returned.  Note the difference from Ã: Å n will keep ( reading input until it has accumulated n elements or seen an EOF,  then return the data; à n will keep reading only until B it has received any non-empty amount of data, even if the amount  received is less than n elements and there is no EOF. ÆPuts strings (or  data) to a file , then  writes an EOF to the handle. @Note that this does not put the handle into binary mode. To do  this, you may need to call  h ¾ on the  handle before using it with handleI. Otherwise, Haskell by C default will treat the data as UTF-8. (On the other hand, if the  9 corresponds to a socket and the socket is being read in  another thread, calling  can cause deadlock, so in ? this case it is better to have the thread handling reads call  .) :Also note that Haskell by default buffers data written to  6s. For many network protocols this is a problem. Don't  forget to call  h  before passing a  handle to Æ. Ç.Sends a list of packets to a datagram socket. ÈBSends output to a stream socket. Calls shutdown (e.g., to send a % TCP FIN packet) upon receiving EOF. ÉAn /. that uses  to write all output to . ÊA handler function for the º¹, ¸·, and ¶µ control  requests. fileCtl is used internally by Ó and  Ð1, and is exposed for similar enumerators to use. ËA handler for the ´³ control request. ÌARead datagrams (of up to 64KiB in size) from a socket and feed a ; list of strings (one for each datagram) into an Iteratee. Í=Read datagrams from a socket and feed a list of (Bytestring, ; SockAddr) pairs (one for each datagram) into an Iteratee. Î,Read data from a stream (e.g., TCP) socket. Ï A variant of Ð& type restricted to input in the Lazy   format. Ð$Puts a handle into binary mode with , then 1 enumerates data read from the handle to feed an /. with any   input type. Ñ Feeds an /./ with data from a file handle, using any input  type in the  class. Note that enumNonBinHandle  uses the handle as is, unlike Ð, and so can be used if / you want to read the data in non-binary form. Ò5Enumerate the contents of a file as a series of lazy  *s. (This is a type-restricted version of  Ó.) Ó(Enumerate the contents of a file for an /. taking input in  any * type. Note that the file is opened with   to ensure binary mode. ÔEnumerate standard input. Õ(Feed exactly some number of bytes to an /.. Throws an error ' if that many bytes are not available. Ö>Feed up to some number of list elements (bytes in the case of   s) to an /., or feed fewer if the /. returns , or an EOF is encountered. The formulation  inumMax n ƒ iter  can be used to prevent iter% from consuming unbounded amounts of  input. ×This inner enumerator is like – in that it passes  unmodified 210s straight through to an iteratee. However, it  also logs the 21/s to a file (which can optionally be truncated 0 or appended to, based on the second argument). Path to log to True to truncate file ØLike ×2, but takes a writeable file handle rather than a 2 file name. Does not close the handle when done. Ù.Log a copy of everything to standard error. ( inumStderr =  Ø ) ÚAn }! that converts input in the lazy  format  to strict s. Û The dual of Ú--converts input from strict   s to lazy s. ÜAdd a finalizer to run when an /. has received an EOF and an  }< has finished. This works regardless of the order in which  the two events happen. Cleanup action 5Cleanup action will run when these two are both done Ý"Iterizes" a file  by turning into an | (for  reading) and an /. (for writing). Uses Ü to    the  when both the /. and | are finished. ; Puts the handle into binary mode, but does not change the  buffering. Þ"Iterizes" a stream  by turning into an | (for  reading) and an /. (for writing). Uses Ü to  ! the  when both the /. and | are finished. 0 ³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞ0»¼½¾¿ÀÂÁÄÃÅÆÇÈÉ  ¹º·¸µ¶Ê³´ËÌÍÎÐÏÑÓÒÔÖÕרÙÚÛÜÝÞ,³´´µ¶¶·¸¸¹ºº»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞ1ßAn infix synonym for N that allows LL(*) parsing of B alternatives by executing both Iteratees on input chunks as they ! arrive. This is similar to the <|> method of the   Alternative class in Control.Applicative , but the   Alternative5 operator has left fixity, while for efficiency this  one has:  infixr 3 <|> àAn infix synonym for P that allows LL(*) parsing of D alternatives by keeping a copy of input data consumed by the first D Iteratee so as to backtrack and execute the second Iteratee if the D first one fails. Returns a function that takes a continuation for  the first /. , should it succeed. The code:  B iter1 \/ iter2 $ \iter1Result -> doSomethingWith iter1Result  Executes iter14 (saving a copy of the input for backtracking). If  iter1" fails with an exception of class  IterNoParse , then the  input is re-wound and fed to iter2. On the other hand, if  iter1 succeeds and returns  iter1Result, then the saved input is  discarded (as iter2, will not need to be run) and the result of  iter1 is fed to function doSomethingWith. 8For example, to build up a list of results of executing iter, one . could implement a type-restricted version of  as follows:   @ myMany :: (ChunkData t, Monad m) => Iter t m a -> Iter t m [a]  myMany iter = iter \/ return [] " \r -> Í ((:) r) (myMany iter) In other words, myMany tries running iter. If iter fails,  then myMany returns the empty list. If iter succeeds, its  result r6 is added to the head of the list returned by calling  myMany9 recursively. This idiom of partially applying a binary E funciton to a result and then applying the resulting function to an  /. via Í2 is so common that there is an infix operator for  it, á(. Thus, the above code can be written:    myMany iter = iter \/ return [] " (:) á myMany iter Of course, using Í, is not the most efficient way to implement  myMany6. If you are going to use this pattern for something A performance critical, you should use an accumulator rather than  build up long chains of Í&s. A faster implementation would be:    myMany iter = loop id  where loop ac = iter \/ return (acc []) " a -> loop (acc . (a :)) \/ has fixity:  infix 2 \/ á (f >$> a) t is equivalent to f t  a (where  is and  infix alias for Í#). Particularly useful with infix  combinators such as à and `ã` when chaining parse  actions. See examples at à and ã. Note Í is not ; always the most efficient solution (see an example in the  description of à).  Has fixity:  infixl 3 >$> â fa $> b = b <$ fa+ -- replaces the output value of a functor / with some pure value. Has the same fixity as  and  ,  namely:  infixl 4 $> ã Defined as  orEmpty = (à return À), and useful when , parse failures should just return an empty ¿. For example,  a type-restricted  can be implemented as:   @ myMany :: (ChunkData t, Monad m) => Iter t m a -> Iter t m [a]  myMany iter = iter `ã` (:) á myMany iter  Has fixity:  infixr 3 `orEmpty` äiter <?> token' replaces any kind of parse failure in iter ) with an exception equivalent to calling å prefix token  where prefix* is a prefix of the input that was fed to iter and  caused it to fail.  Has fixity:  infix 0 <?> å Throw an /.- exception that describes expected input not  found. Input actually received %Description of input that was wanted æ Takes an /. returning a  type, executes the  /.9 once, and throws a parse error if the returned value is  #/. (Note that this is quite different from the some  method of the  Alternative class in Control.Applicative, which  executes a computation one or more times. This library does not  use  Alternative because  Alternative's <|> operator has  left instead of right fixity.) çRepeatedly invoke an /.$ and right-fold a function over the  results. $è A variant of ç that requires the /. to succeed at  least once. é A variant of ç that requires the /. to succeed at C least a minimum number of items and stops parsing after executing  the /. some maximum number of times. Minimum number to parse Maximum number to parse Folding function Rightmost value "Iteratee generating items to fold êStrict left fold over an /. (until it throws an  IterNoParse  exception). foldlI f z iter is sort of equivalent to: : ... (f <$> (f <$> (f z <$> iter) <*> iter) <*> iter) ... ë A version of ê that fails if the /. argument does not  succeed at least once. ìfoldMI: is a left fold in which the folding function can execute  monadic actions. Essentially foldMI is to ê as % is  to foldl' in the standard libraries. í A variant of ì that requires the /. to succeed at  least once. î=Discard the result of executing an Iteratee once. Throws an % error if the Iteratee fails. (Like skip x = x >> return ().) ïAExecute an iteratee. Discard the result if it succeeds. Rewind / the input and suppress the error if it fails. ðAEnsures the next input element satisfies a predicate or throws a + parse error. Does not consume any input. ñ"A variant of the standard library & function, but that  translates a ' into any ( type, not just ).  Particularly useful for /.s that must work with both *s  (which consist of ' s) and ASCII  ByteStrings (which consist  of Word83s). For example, to skip one or more space or TAB  characters, you can use:   skipSpace :: ( t e, ChunkData t, + e, ( e, Monad m) =>  /. t m ()  skipSpace = ó (\c -> c == eord ' ' || c == eord '\t') ò>Skip all input elements encountered until an element is found . that does not match the specified predicate. óLike ò-, but fails if at least one element does not  satisfy the predicate. ôBReturn all input elements up to the first one that does not match  the specified predicate. õLike ô5, but fails if at least one element does not satisfy  the predicate. ö A variant of ô with a maximum number matches. Maximum number to match Predicate test ÷ A variant of ô, with a minimum and maximum number matches. Minumum number Maximum number Predicate test øRepeatedly execute an /. returning a ¿ and , " all the results in a right fold. ùLike ø, but fails if the /. doesn't return at least  once. ú A version of ø, that takes a minimum and maximum number of  items to parse. Minimum number to parse Maximum number to parse /. whose results to concatenate ûThis /. parses a - argument. It does not C consume any Iteratee input. The only reason it is an Iteratee is @ so that it can throw an Iteratee parse error should it fail to < parse the argument string (or should the argument yield an  ambiguous parse). üBEnsures the input is at the end-of-file marker, or else throws an  exception. ý, the result of two  types returning  ¿ types (<++> = . ,). Has the same fixity  as / , namely:  infixr 5 <++> þ0 an  type onto an an    type (<:> = . 0). Has the same  fixity as : , namely:  infixr 5 <:> ÿnil =  À --An empty ¿ injected into an   type. Run an /.2 zero or more times (until it fails) and return a % list-like container of the results. Repeatedly run an /.$ until it fails and discard all the  results. Parses a sequence of the form  3Item1 Separator Item2 Separator ... Separator ItemN  and returns the list [Item1, Item2, ..., ItemN]  or a  equivalent. Item to parse Separator between items Returns  list of items Like 4, but expects a separator after the final item. In , other words, parses a sequence of the form  =Item1 Separator Item2 Separator ... Separator ItemN Separator  and returns the list [Item1, Item2, ..., ItemN] or  a  equivalent. Item to parse %Separator that must follow each item Returns  list of items -Accepts items that would be parsed by either  or .  Essentially a version of ! in which the final separator is  optional. Run an /.1 one or more times (until it fails) and return a % list-like container of the results.  A variant of " that throws a parse error if the /. ! does not succeed at least once.  A variant of ( that throws a parse error if it cannot  return at least one item.  A variant of ( that throws a parse error if it cannot  return at least one item.   A variant of ( that throws a parse error if it cannot  return at least one item.  <Read the next input element if it satisfies some predicate.  Otherwise throw an error.  -Read input that exactly matches a character.  -Read input that exactly matches some target.  *Read input that exactly matches a string. -Read input that matches a string up to case. 8 ßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ     8ßàãäåæçèéêëìíîïðñòóôõö÷øùúûü âáýþÿ     0ßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ     @Feeds input to an Iteratee until some boundary string is found. C The boundary string is neither consumed nor passed through to the  target /./. (Thus, if the input is at end-of-file after @ inumStopString returns, it means the boundary string was never  encountered.) 12AReads input until it can uniquely determine the longest key in a  39 that is a prefix of the input. Consumes the input that = matches the key, and returns the corresponding value in the  36, along with the residual input that follows the key. mapLI is a variant of  that takes a list of   (key, value) pairs instead of a 3.  mapLI =  . 4.  Control request to fetch the SSL object associated with an  enumerator. A wrapper around the type 5 to make it an instance of the  6 class. Simple OpenSSL |. Simple OpenSSL /.,. Does a uni-directional SSL shutdown when  it receives a 21 with the EOF bit ¾. Turn a socket into an /. and | that use OpenSSL to write 9 to and read from the socket, respectively. Does an SSL E bi-directional shutdown and closes the socket when both a) the enum 6 completes and b) the iter has received an EOF chunk. !If the SSL handshake fails, then iterSSL closes the socket before  throwing an exception. 9This funciton must only be invoked from within a call to   withOpenSSL. OpenSSL context  The socket ¾ for server handshake,  for client BSimplest possible SSL context, loads cert and unencrypted private  key from a single file. ?Quick and dirty funciton to generate a self signed certificate , for testing and stick it in a file. E.g.: ) genSelfSigned "testkey.pem" "localhost"  Filename in which to output key "Common Name (usually domain name)   7State used by , the most generic zlib }.  Create the state using  or . 89:;<=>?@ Create a * for compression. See the description of   deflateInit21 in the zlib.h C header file for a more detailed E description of the arguments. Note in particular that the value of   windowBits7 determines the encapsulation format of the compressed  data:  8..15 = zlib format  24..31 = gzip format 0 -8..-15 = means raw zlib format with no header Compression level (use  for default)  Method (use )  windowBits (e.g., ) memLevel (e.g., ) strategy (e.g., )  Create a Zstate, for uncompression. See the description of   inflateInit21 in the zlib.h C header file for a more detailed E description of the arguments. Note in particular that the value of   windowBits7 determines the encapsulation format of the compressed  data:  8..15 = zlib format  24..31 = gzip format ' 40..47 = automatically determine zlib/ gzip format 0 -8..-15 = means raw zlib format with no header  windowBits ABCDEFGHIJKThe most general zlib }, which can take any  created  by  or .  An }5 that compresses in zlib format. To uncompress, use  ". !An }! that compresses in gzip format. "An }5 that uncompresses a data in either the zlib or gzip C format. Note that this only uncompresses one gzip stream. Thus, = if you feed in the concatenation of multiple gzipped files,   inumGunzip5 will stop after the first one. If this is not what  you want, then use š inumGunzip to decode repeated  gzip streams.   !" !"   !"¾  !"#$%&'()*+,-./012356789:;<=?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞ #Class of types whose /.s can be converted to strict  s. Basically just strict  s and lazy  )s. This class mostly exists so that the % 3 function can work with either type of ByteString. $%Run an attoparsec parser in an /. monad. Throws an  ! exception with constructor # if the parse - fails. (This exception can be handled with N and  O.) &+Try running an attoparsec parser. Returns Ù a if the  parser succeeds with result a . Returns Ú err where err D is an error message otherwise. Note that the input stream will be D in an indeterminate state should the parser fail. (If you need to C keep parsing input from some known state, it may be better to use  % in conjunction with N.) #$%&#$%&#$$%& 'BData structure describing the configuration of an HTTP server for  n. ()*+,@Given the headers of an HTTP request, provides an iteratee that ? will process the request body (if any) and return a response. -AA data structure describing an HTTP response message to be sent, E parameterized by the Monad in which the response will be written to  the network. ./The response status. 0Headers to send back 12True if the message body should be passed through  O and a "Transfer-Encoding: chunked" header , should be added. Generally this should be ¾ unless you  have added a Content-Length header, manually set up chunk  encoding by fusing it in 2, or are not returning a  message body with the reply. 2|" producing the message body. Use — (which is  an empty }1) to produce an empty body for responses that do  not contain a body. 3AHTTP status code and text description of response, for the first D line of an HTTP response message. A bunch of pre-defined statuses , from RFC 2616 are supplied under the names T, \,  ^, etc. 45BData structure representing the name and metadata of a control in  a submitted form. 67)Name of the form control being processed 8Parameters from the Content-Disposition: header. This only  applies to Content-Type: multipart/ form-data, and will be $ empty for forms of type application/x-www-form-urlencoded or 9 forms submitted in the URL parameters of a GET request. 9Extra headers following the Content-Disposition: header of  a  multipart/ form-data& post. Empty for other kinds of form  submission. :5Data structure representing an HTTP request message. ;<Method (e.g., GET, POST, ...). =-Raw path from the URL (not needed if you use  reqPathList  and  reqPathParams). >>URL request path, broken into a list of directory components,  and normalized to remove "." and process "..". ?Used by routeVar& to save pathname components that are ? variables (used as a stack, so the last variable saved is the  first one in the list). @:Stores pathname components that have been stripped off of   reqPathLst during routing. A!The portion of the URL after the ? character (if any). B>Lower-case host header (or the host from the request line, if & the request is for an absolute URI). C(Port number if supplied in Host header. D;HTTP version major and minor number from the request line. E6List of all header field names and values in the HTTP ; request. Field names are converted to lowercase to allow  easier searching. F)List of Cookies supplied in the request. G>Parsed version of the Content-Type header, if any. The first  2 is the actual content type. Following this is a @ list of parameter names and values. The most useful parameter  is "boundary", used with the  multipart/ form-data content  type. H,Value of the content-Length header, if any. I9A list of the encodings in the Transfer-Encoding header. JLMNOSecton 19.3 of RFC2616: ÑThe line terminator for message-header fields is the sequence CRLF. However, we recommend that applications, when parsing such headers, recognize a single LF as a line terminator and ignore the leading CR. PSpaces and tabs QLinear whitespace, defined as:  ( LWS = [CRLF] 1*( SP | HT ) Parses as a single space R olws = ï QSnon-control characters T'TEXT = 1*(any OCTET except CTLs | LWS) UT+ excluding some list of except characters. V4Parse one hex digit and return its value from 0-15. W#Parse a raw hexadecimal number (no "0x..." prefix). X1*<"any CHAR except CTLs or separators> YLazy  version of X. Z<Percent-decode input for as long as the non percent-escaped " characters match some predicate. [%Parse a backslash-escaped character. \T and [s surrounded by double quotes. ]K4Formats a time in the format specified by RFC 2616. ^_`abcdeL Parses a Date/,Time string in any one of the three formats  specified by RFC 2616. f-RFC3986 syntax classes unreserved characters ghijklmnop$Returns (scheme, host, path, query) q%Returns (scheme, host, path, query). r&Turn a path into a list of components sM8Returns a normalized version of the full requested path  (including all context in reqCtx) in the URL (e.g., where "."  has been eliminated, ".."& has been processed, there is exactly  one '/'5 between each directory component, and the query has  been stripped off). tu*HTTP request line, defined by RFC2616 as: = Request-Line = Method SP Request-URI SP HTTP-Version CRLF vwxyz{|}~N#Parse an HTTP header, returning an ;: data structure. O2An HTTP Chunk encoder (as specified by RFC 2616). P2An HTTP Chunk decoder (as specified by RFC 2616). QThis }3 reads to the end of an HTTP message body (and not A beyond) and decodes the Transfer-Encoding. It handles straight > content of a size specified by the Content-Length header and  chunk-encoded content. RBParses a form, and folds a function over each control. The value E of each control is available through Iteratee input. Thus, you can " extract the submitted value with T, or redirect it elsewhere  by executing another /.$. For example, to parse a form and D print it to standard output (without buffering possibly large file  uploads in memory):   do let docontrol _ field = do  liftIO $ putStrLn $ G "The value of " ++ (S8.unpack $ ffName field) ++ " is:" K stdoutI -- Send form value to standard output " liftIO $ putStrLn "\n"  foldForm req docontrol () DOr to produce a list of (field, value) pairs, you can say something  like:  " do let docontrol acc field = do  val <- pureI . return $ (ffName field, val) : acc  foldForm req docontrol [] &Note that for POSTed forms of enctype   application/x-www-form-urlencoded, foldForm will read to the 4 end of its input. Thus, it is important to ensure foldForm is  called from within an Q enumerator (which is  guaranteed by n). €‚ƒ„…†‡ˆ‰Š‹ŒSTUVWXYZ[\]^_Ž`:An empty HTTP response, to which you must add headers and  possibly a message body. a Generate an .- without a body. b Generate an .- with a body of type text/html. Body as a pure lazy  cMake an .-. of an arbitrary content-type based on a pure  lazy 1. Since the result is pure, this function first E measures its length so as to set a Content-Length header instead of  using HTTP chunk encoding. Value for Content-Type: header Contents of response body dMake an .-* of an arbitrary content-type based on an  |= that will dynamically generate the message body. Since the C message body is generated dynamically, the reply will use an HTTP  chunk encoding. Value for Content-Type header: |, that will generate reply body dynamically. e$Generate a 301 (redirect) response. f%Generate a 303 (see other) response. g%Generate a 403 (forbidden) response. h%Generate a 404 (not found) response. i.Generate a 405 (method not allowed) response. j1Generate a 500 (internal server error) response. k1Format and enumerate a response header and body.  Time for Date: header (if desired) lGenerate a null ('" structure with no logging and no  Date header. m Generate an ('( structure that uses IO calls to log to > standard error and get the current time for the Date header. nAn }- that behaves like an HTTP server. The file  Examples/ httptest.hs) that comes with the iterIO distribution / gives an example of how to use this function. Server configuration H'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnH:;<=>?@ABCDEFGHIJMNQOPKL56789R34STUVWXYZ[\]^_-./012`abcdefghijk,'()*+lmnH'()*+()*+,-./012./012344567896789:;<=>?@ABCDEFGHIJ;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmn o=An abstract representation of file system calls returning an  opaque handle type h in an /. parameterized by an arbitrary  Î m). This representation allows one to use  ‰' in a monad that is not an instance of Ð. pqReturn file attributes. r.Open file and return an opaque handle of type h. s=Close an open file. You must call this unless you apply the  enumerator returned by fs_enum. t'Return the attributes of an open file. u=Enumerate the contents of an open file, then close the file.  If you apply the | returned by fs_enum, you do not need  to call fs_close. vType alias for the argument of . w*Simple HTTP request routing structure for n. This # is a wrapper around a function on ;: structures. If the  function accepts the ;: , it returns Õ a response  action. Otherwise it returns Ì.  HttpRoute is a ¿%, and hence can be concatenated with  , or ‘,. For example, you can say something like:  C simpleServer :: Iter L.ByteString IO () -- Output to web browser D -> Onum L.ByteString IO () -- Input from web browser  -> IO () @ simpleServer iter enum = enum |$ inumHttpServer server .| iter & where htdocs = "/var/www/htdocs" 8 server = ioHttpServer $ runHttpRoute routing M routing = mconcat [ routeTop $ routeConst $ resp301 "/start.html" @ , routeName "apps" $ routeMap apps H , routeFileSys mimeMap "index.html" htdocs  ] + apps = [ ("app1", routeFn app1) - , ("app2", routeFn app2) ]  B app1 :: (Monad m) => HttpReq -> Iter L.ByteString m (HttpResp m)  app1 = ... .The above function will redirect requests for / to the URL  / start.html6 using an HTTP 301 (Moved Permanently) response. Any  request for a path under apps will be redirected to the  functions app1, app2*, etc. Finally, any other file name will , be served out of the file system under the "/var/www/htdocs" # directory. (This example assumes mimeMap has been constructed as  discussed for †.) xy’z6Prepend a header field to the response produced by an xw  if that xw- is successful. For example, to let clients / cache static data for an hour, you might use:   addHeader (“ "Cache-control: max-age=3600") $  ˆ mime (‡ " index.html") "/var/www/htdocs" {?Route all requests to a constant response action that does not A depend on the request. This route always succeeds, so anything  ,ed will never be used. |@Route all requests to a particular function. This route always  succeeds, so anything ,ed will never be used. }@Select a route based on some arbitrary function of the request. - For most purposes, the existing predicates (ƒ,  „8, etc.) should be fine, but occationally you might want E to define a custom predicate. For example, to reject methods other  then "GET" or "POST"* at the top of your route, you could say:   myRoute = ‘ [ rejectBadMethod & , otherRoute1  , ...  ]  ...  rejectBadMethod :: xw m rejectBadMethod =  routeReq $ req ->  case < req of  s | s == “ "GET" || s == “ "PUT" ->  À4 {- reject route, falling through L to rest of myRoute -}  _ -> { $ i req {- reject request -} ~Route the root directory (/). Route requests whose "Host:" header matches a particular  string. 4String to compare against host (must be lower-case) 'Target route to follow if host matches €@Route based on the method (GET, POST, HEAD, etc.) in a request. String method should match 'Target route to take if method matches routeMap* builds an efficient map out of a list of  (directory_name, xw)% pairs. It matches all requests and E returns a 404 error if there is a request for a name not present in  the map. ‚routeMap' is like routeMap$, but only matches names that exist  in the map. Thus, multiple routeMap' results can be combined  with ,. By contrast, combining routeMap results with  ,8 is useless--the first one will match all requests (and > return a 404 error for names that do not appear in the map). ƒ'Routes a specific directory name, like  for a singleton  map. „Routes a specific path, like ƒ, except that the path " can include several directories. …@Matches any directory name, but additionally pushes it onto the  front of the ? list in the ;: structure. This A allows the name to serve as a variable argument to the eventual  handling function. †Parses  mime.types- file data. Returns a function mapping file B suffixes to mime types. The argument is a default mime type for C suffixes to do not match any in the mime.types data. (Reasonable  defaults might be "text/html", "text/plain" , or, more ! pedantically but less usefully, " application/ octet-stream".) Since this likely doesn'*t change, it is convenient just to define < it once in your program, for instance with something like: $ mimeMap :: String -> S8.ByteString  mimeMap = unsafePerformIO $ do 1 path <- findMimeTypes ["mime.types" 7 , "/etc/mime.types" A , "/var/www/conf/mime.types"] D enumFile path |$ mimeTypesI "application/octet-stream"  where 5 findMimeTypes (h:t) = do exist <- fileExist h L if exist then return h else findMimeTypes t @ findMimeTypes [] = return "mime.types" -- cause error ”/Default file system calls for instances of the MonadIO class. ‡dirRedir indexFileName) redirects requests to the URL formed by  appending "/" ++ indexFileName to the requested URL. •ˆARoute a request to a directory tree in the file system. It gets ( the Content-Length from the target file's attributes (after opening E the file). Thus, overwriting files on an active server could cause ? problems, while renaming new files into place should be safe. (Map of file suffixes to mime types (see †) 3Handler to invoke when the URL maps to a directory 2 in the file system. Reasonable options include:  (– À)# to do nothing, which results in a  403 forbidden,  (‡ " index.html") to redirect directory " accesses to an index file, and  a recursive invocation such as (routeFileSys  typemap . (++ "/ index.html")) to re-route the $ request directly to an index file. 0Pathname of directory to serve from file system ‰A generalized version of ˆ that takes a  po. object and can therefore work outside of the  Ð monad. Other than the po object, the . arguments and their meaning are identical to ˆ. opqrstuvwxyz{|}~€‚ƒ„…†‡ˆ‰wxyz{|}€~v‚ƒ„…†‡ˆopqrstu‰opqrstupqrstuvwxxyz{|}~€‚ƒ„…†‡ˆ‰—  ! " # $ % & ' ( ) * + ,--./0123456789::;<=>?@@ABBCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrsttuvwxyz{|}~€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÂÃÃÄÄÅÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ            ! " # $%&'()*+ , - . / 0 0 1 2 3 4 5 5 6 7 8 9 : : ; ; < = > ? ? @ 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 [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s s t u v w x y z z { | } ~  €  ‚ ƒ „ … † ‡ ˆ ‰ Š ‹ Œ  Ž   ‘ ’ “  ” ” ! • • – – — ˜ ™ š › œ  ž Ÿ   ¡ ¢ £ ¤ ¥ ¦ § ¨ © ª « ¬ ­ ® ¯ ° ± ² ³ ´ µ¶·¶¸¹º»¹¼½¹¼¾¿ÀÁÂÃÂÄÅD¿ÀÆÇÈÇÉÇÊÇË̶ÍÎÏÐÑÐÒÓÔÕ¹ºÖרÙÚÛÜÝÐÞÙßÙßàáâáãÙäåæç×èéêÙëì¹íî¹íî¹íïðñòðñóðñôðñõö¹÷ø¹÷øù¹úû¹úû¹üý¹üý¹þÿ¹þÿ¹¹¹¹¹î¹î¹¹¹¹¹       !" #$%&'%()*+*,-%(./0/1/2 3"*456%&D7¶89¿:;<=¿:>?@AÂB%CDEF%&GHIJKLJKMNOPéQR%STUVWXYZ[\]^_`abcde f g h i j k l m n o p q r s t u v w x y z { | } ~  €  ‚ ƒ „ … † ‡ ˆ ‰ Š ‹ Œ  Ž   ‘ ’ “ ” • – — ˜ ™ š › œ  ž Ÿ   ¡ ¢ £ ¤ ¥ ¦ § ¨ © ªÂ« ¬ ­® ¯ °±² iterIO-0.1Data.IterIO.ParseData.IterIO.ListLikeData.IterIO.ZlibData.IterIO.IterData.IterIO.TransData.IterIO.InumData.IterIO.ExtraData.IterIO.SearchData.IterIO.SSLData.IterIO.AttoData.IterIO.HttpData.IterIO.HttpRouteData.IterIO.ZlibInt Data.IterIObaseControl.Applicative Applicative<**><**><*>pure Data.Functor<$> GHC.IO.Device AbsoluteSeek RelativeSeek SeekFromEndSeekModeGHC.Base<$ZMethod ZStrategy max_wbits max_mem_level def_mem_level zlib_versionz_DEFAULT_COMPRESSION z_FILTEREDz_HUFFMAN_ONLYz_RLEz_FIXEDz_DEFAULT_STRATEGY z_DEFLATED IterCUnsuppIterRFailDoneIterCIterMIterFIterFail IterMzero IterParseErr IterEOFErr IterExpected IterExceptionCtlArgCtlResCtlDoneCtlFail CtlUnsuppCtlCmdIterrunIterChunk ChunkDatanull chunkShowchunkchunkEOFiterF isIterActive iterShowsiterShowfmapIfmapRrunrunRrunI mkIterEOFthrowI throwEOFI throwParseIcatchItryItryRItryEOFItryFIfinallyI onExceptionItryBItryFBI multiParseifParse ifNoParsenullIdata0IdataIpureIchunkI whileNullIpeekIatEOFIungetIsafeCtlIctlIstepR'stepRonDoneRonDonegetResidsetResidrunIterR reRunIter IterStateT runIterStateTigetigetsiputimodify adaptIter adaptIterMliftI liftIterIO runContTI runErrorTI runListTI runReaderTIrunRWSIrunRWSLI runStateTI runStateTLI runWriterTI runWriterTLIInumM CtlHandler ResidHandlerOnumInum|$.|$catlcat|..| inumCatch inumFinallyinumOnExceptionresumeIverboseResumeInoCtlpassCtlconsCtlmkCtl mkFlushCtlrunIterM runIterMCrunInummkInumCmkInummkInumP pullupResid inumBracketinumNopinumNullinumPureenumPure inumRepeat setCtlHandler setAutoEOF setAutoDone addCleanup withCleanup mkInumAutoMmkInumMifeedifeed1ipipeirunirepeat ipopresididoneSendRecvStringgenRecvgenSend genRecvFrom genSendToiterLoop inumSplit hShutdown traceInputtraceI GetSocketCTellCSeekCSizeCputIsendIheadLI safeHeadLIheadI safeHeadI safeLineIlineI data0MaxIdataMaxItakeIhandleI sockDgramI sockStreamIstdoutIfileCtl socketCtl enumDgram enumDgramFrom enumStream enumHandle' enumHandleenumNonBinHandle enumFile'enumFile enumStdin inumTakeExactinumMaxinumLoginumhLog inumStderrinumLtoSinumStoL pairFinalizer iterHandle iterStream<|>\/>$>$>orEmpty expectedIsomeIfoldrIfoldr1I foldrMinMaxIfoldlIfoldl1IfoldMIfoldM1IskipI optionalIensureIeord skipWhileI skipWhile1IwhileIwhile1I whileMaxI whileMinMaxIconcatIconcat1I concatMinMaxIreadIeofI<++><:>nilmanyskipManysepByendBysepEndBymany1 skipMany1sepBy1endBy1 sepEndBy1satisfycharmatchstring stringCaseinumStopStringmapImapLISslC SslConnectionunSslConnectionenumSslsslIiterSSL simpleContext genSelfSignedZState deflateInit2 inflateInit2 inumZStateinumZlibinumGzip inumGunzipIterStrictByteStringfromIterStrictByteStringattotryAttoHttpServerConf srvLoggersrvDate srvHandlerHttpRequestHandlerHttpResp respStatus respHeaders respChunkrespBody HttpStatus FormFieldffNameffParams ffHeadersHttpReq reqMethodreqPath reqPathLst reqPathParams reqPathCtxreqQueryreqHostreqPortreqVers reqHeaders reqCookiesreqContentTypereqContentLengthreqTransferEncodingreqIfModifiedSince http_fmt_timedateI reqNormalPathhttpReqI inumToChunksinumFromChunks inumHttpBodyfoldFormstat100stat200stat301stat302stat303stat304stat400stat401stat403stat404stat405stat500stat501defaultHttpResp mkHttpHead mkHtmlRespmkContentLenResp mkOnumRespresp301resp303resp403resp404resp405resp500 enumHttpRespnullHttpServer ioHttpServerinumHttpServerFileSystemCallsfs_statfs_openfs_closefs_fstatfs_enumHttpMap HttpRoute runHttpRoute addHeader routeConstrouteFnrouteReqrouteTop routeHost routeMethodrouteMap routeMap' routeName routePathrouteVar mimeTypesIdirRedir routeFileSysrouteGenFileSys c_inflateEnd c_inflatec_inflateInit2 c_inflateInit c_deflateEnd c_deflatec_deflateInit2 c_deflateInit ZDataTypeZFlushZStream z_stream_sizez_stream_alignmentnext_inavail_intotal_innext_out avail_out total_outmsgzalloczfreeopaque data_typeadler z_NO_FLUSH z_SYNC_FLUSH z_FULL_FLUSHz_FINISHz_BLOCKz_OK z_STREAM_END z_NEED_DICTz_ERRNOz_STREAM_ERROR z_DATA_ERROR z_MEM_ERROR z_BUF_ERRORz_VERSION_ERRORz_BINARYz_TEXT z_UNKNOWN Control.Monadmplusmzerotransformers-0.2.2.0Control.Monad.IO.ClassliftIOControl.Monad.Trans.Class MonadTransliftghc-primGHC.BoolTrue Data.MonoidMonoidmemptyGHC.ListFalseGHC.ShowShowSShowshowsshowiterTcliftM>>=return Data.MaybeMaybeNothingfmapMonad fixMonadIOMonadIOSystem.IO.Errorcatch GHC.ExceptionthrowGHC.IO.ExceptionIOError genCatchIJust SomeExceptionfail Data.EitherRightLeft ExceptioncombineExpected onDoneInput $fMonadIOIter isEOFError Data.Typeablecast fromException$fChunkDataChunk Control.Monad.Trans.State.StrictStateT runStateT mtl-2.0.1.0Control.Monad.State.ClassgetgetsputmodifyidControl.Monad.Trans.ListListTjoinliftControl.Monad.Trans.ContContTControl.Monad.Trans.ErrorErrorTControl.Monad.Trans.ReaderReaderTControl.Monad.Trans.RWS.StrictRWSTControl.Monad.Trans.RWS.LazyControl.Monad.Trans.State.Lazy!Control.Monad.Trans.Writer.StrictWriterTControl.Monad.Trans.Writer.Lazy runWriterT unIterStateT InumState insAutoEOF insAutoDoneinsCtlinsIter insCleanup insCleaningGHC.IOFilePathfoldrjoinRwithResidHandler runIterRMCdefaultInumStatencmodifyrunInumM c_shutdownnetwork-2.3.0.2Network.SocketSocketechrGHC.IO.Handle.TypesHandlebytestring-0.9.1.10Data.ByteString.Lazy.Internal ByteStringData.ByteString.LazyhPutListLike-3.1.1Data.ListLike.BaseListLikeData.ListLike.IO ListLikeIO GHC.IO.HandlehSetBinaryMode hSetBuffering NoBufferinghPutStrGHC.IO.Handle.FDstdoutopenBinaryFilestderrData.ByteString.InternalhClosesClose$ innerFoldrIfoldMord GHC.TypesCharGHC.EnumEnumIntString GHC.ClassesEqmappendData.ListLike.String StringLikeliftA2++conslongestCommonPrefixfindLongestPrefixcontainers-0.4.0.0Data.MapMapfromList HsOpenSSL-0.9OpenSSL.SessionSSLTypeableZMzStreamzOpzFinishzInChunk zOutChunkzOut defaultZState newZStreamwithZFPzPeekzPokezPokeFP zMinusPtrzPushInzPopInzOutLenzPopOutzMkSpacezExecSL strictifycrlfspaceslwsolwsnoctltext text_excepthexhexInttokentoken'percent_decode quoted_pair quoted_string parameterdowmapweekdayImonmapmonthItimeI rfc822_time rfc850_time asctime_timerfc3986_unreservedrfc3986_gen_delimsrfc3986_sub_delimsrfc3986_schemecharsrfc3986_addrcharsrfc3986_pcharslashrfc3986_syntax rfc3986_testhostIpathIabsUriuri path2listdefaultHttpReqhTTPvers request_linerequest_headershost_hdr cookie_hdrcontent_type_hdrcontent_length_hdrtransfer_encoding_hdrif_modified_since_hdr hdr_field_valany_hdrdefaultFormField urlencoded urlencTabcontrolIinumBind foldControlsfoldUrlencoded foldQuery multipart reqBoundary multipartI inumMultipart foldMultipartmkStatfmtStat respAddHeaderhtmlEscapeChar htmlEscapemconcatpopPathData.ByteString.Char8packdefaultFileSystemCalls modTimeUTCconst