a       !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ /A  ? which can throw exceptions. Note that this does not work in a  vanilla ST$ monad. Instead, you should use the  transformer on  top of ST. 8The express purpose of this transformer is to allow the  monad to  catch exceptions via the  typeclass. IThe Resource transformer. This transformer keeps track of all registered ( actions, and calls them upon exit (via !). Actions may be  registered via /, or resources may be allocated atomically via   or +. The with functions correspond closely to bracket. /Releasing may be performed before exit via the   function. This is a N highly recommended optimization, as it will ensure that scarce resources are  freed early. Note that calling release% will deregister the action, so that 1 a release action will only ever be called once. FA lookup key for a specific release action. This value is returned by  ,  and , and is passed to  . A   which can safely run  calls. A helper class for ', stating that the base monad provides IO  actions. A  2 based on some monad which allows running of some  , actions, via unsafe calls. This applies to  and , for instance. A A with a base that has mutable references, and allows some way to ) run base actions and clean up properly. AThe base monad for the current monad stack. This will usually be IO  or ST. Run some action in the Base% monad. This function corresponds to  :, but due to various type issues, we need to have our own  version here. EGuarantee that some initialization and cleanup code is called before J and after some action. Note that the initialization and cleanup lives in 5 the base monad, while the body is in the top monad. init cleanup body KA base monad which provides mutable references and some exception-safe way L of interacting with them. For monads which cannot handle exceptions (e.g.,  G), exceptions may be ignored. However, in such cases, scarce resources  should not; be allocated in those monads, as exceptions may cause the  cleanup functions to not run. The instance for $, however, is fully exception-safe. Minimal complete definition: Ref, newRef', readRef' and writeRef'. Create a new reference. Read a value from a reference. Write a value to a reference. 9Modify a value in a reference. Note that, in the case of IO stacks, this  is an atomic action. FPerform some allocation, and automatically register a cleanup action. If you are performing an IO- action, it will likely be easier to use the  - function, which handles types more cleanly.  allocate free resource Same as , but explicitly uses IO as a base.  allocate free resource ERegister some action that will be called precisely once, either when  ! is called, or when the  is passed to  . HCall a release action early, and deregister it from the list of cleanup  actions to be performed. ! Unwrap a 7 transformer, and call all registered release actions. ;Note that there is some reference counting involved due to $. L If multiple threads are sharing the same collection of resources, only the  last call to  runResourceT will deallocate the resources. "Transform the monad a  ResourceT& lives in. This is most often used to 9 strip or add new transformers to a stack, e.g. to run a ReaderT . Note that 4 the original and new monad must both have the same   monad. #Same as , but immediately  any exception returned. $HIntroduce a reference-counting scheme to allow a resource context to be G shared by multiple threads. Once the last thread exits, all remaining  resources will be released. HNote that abuse of this function will greatly delay the deallocation of I registered resources. This function should be used with care. A general  guideline: LIf you are allocating a resource that should be shared by multiple threads, N and will be held for a long time, you should allocate it at the beginning of  a new  ResourceT block and then call resourceForkIO from there. %  !"#$%! $"#   %     !"#$ %A monadic action generating a )(. See Source and Sink  for more motivation.  Since 0.0.0 &'(IA conduit has two operations: it can receive new input (a push), and can  be closed.  Invariants: E Neither a push nor close may be performed after a conduit returns a  -- from a push, or after a close is performed.  Since 0.0.0 )*+,When data is pushed to a Conduit$, it may either indicate that it is J still producing output and provide some, or indicate that it is finished M producing output, in which case it returns optional leftover input and some  final output.  Since 0.0.0 -. %&'()*+,-. %&'&'()*+)*+,.--./Most 2)s require some type of state, similar to  PreparedSource s. Like a Source for a PreparedSource, a Sink is a ! simple monadic wrapper around a  PreparedSink which allows initialization  of such state. See Source for further caveats. Note that this type provides a " instance, allowing you to easily  compose Sink s together.  Since 0.0.0 012KIn general, a sink will consume data and eventually produce an output when  it has consumed "enough"0 data. There are two caveats to that statement: K Some sinks do not actually require any data to produce an output. This is . included with a sink in order to allow for a  instance. I Some sinks will consume all available data and only produce a result at  the "end" of a data stream (e.g., sum). +To allow for the first caveat, we have the 6 constructor. For the  second, the 35 constructor has two records: one for receiving more M input, and the other to indicate the end of a stream. Note that, at the end 5 of a stream, some output is required. If a specific 0/ implementation M cannot always produce output, this should be indicated in its return value,  using something like a  or .  Invariants:  After a 2 produces a result (either via 4 or  57), neither of those two functions may be called on the Sink  again.  If a Sink> needs to clean up any resources (e.g., close a file handle), 8 it must do so whenever it returns a result, either via sinkPush or   sinkClose. Note that, due to usage of  ResourceT, this is merely an  optimization.  Since 0.0.0 34567A Sink= ultimately returns a single output value. Each time data is  pushed to it, a Sink3 may indicate that it is still processing data, or L that it is done, in which case it returns some optional leftover input and  an output value.  Since 0.0.0 89 /0123456789 /010126345345679889 : Construct a 0/5 with some stateful functions. This function address  all mutable state for you.  Since 0.0.0 initial state push AClose. Note that the state is not returned, as it is not needed. ; Construct a 0/3. Note that your push and close functions need not ! explicitly perform any cleanup.  Since 0.0.0  resource and/or state allocation  resource and/or state cleanup push close <Transform the monad a 0/ lives in.  Since 0.0.0 :;<:;< =Helper type for constructing a Conduit based on Sinks. This allows you J to write higher-level code that takes advantage of existing conduits and  sinks, and leverages a sink's monadic interface.  Since 0.0.0 >Return value from a =.  Since 0.0.0 ?Pass control to a new conduit. @End the conduit. A+Set a new state, and emit some new output. B Construct a &%5 with some stateful functions. This function address  all mutable state for you.  Since 0.0.0 initial state Push function. QClose function. The state need not be returned, since it will not be used again. C Construct a &%.  Since 0.0.0  resource and/or state allocation  resource and/or state cleanup GPush function. Note that this need not explicitly perform any cleanup. HClose function. Note that this need not explicitly perform any cleanup. DTransform the monad a &% lives in.  Since 0.0.0 E Convert a = into a &%.  Since 0.0.0 initial state =>?@ABCDE =>A@??@ABCDE  State of a KJ F/This typeclass allows us to unify operators on PO and KJ.  Since 0.0.0 GH Since 0.0.0 IJWhen actually interacting with PO!s, we usually want to be able to K buffer the output, in case any intermediate steps return leftover data. A  KJ$ allows for such buffering, via the M function. A KJ , unlike a PO,, is resumable, meaning it can be passed to  multiple Sinks without restarting.  Finally, a KJ$ relaxes one of the invariants of a PO : calling  L after an EOF will simply return another EOF. A BufferedSource is also known as a resumable source, in that it can be I called multiple times, and each time will provide new data. One caveat: G while the types will allow you to use the buffered source in multiple ) threads, there is no guarantee that all BufferedSources will handle this  correctly.  Since 0.0.0 KLMNOAll but the simplest of SR s (e.g., repeat) require some K type of state to track their current status. This may be in the form of a  mutable variable (e.g., IORef$), or via opening a resource like a Handle.  While a SR4 is given no opportunity to acquire such resources,  this type is. A PO+ is simply a monadic action that returns a SR. One F nice consequence of this is the possibility of creating an efficient  C instance, which will only acquire one resource at a time, instead A of bulk acquiring all resources at the beginning of running the PO. Note that each time you "call" a Source!, it is started from scratch. If H you want a resumable source (e.g., one which can be passed to multiple  Sinks), you likely want to use a KJ.  Since 0.0.0 PQRA SR9 has two operations on it: pull some data, and close the  SR. Since SR is built on top of , all G acquired resources should be automatically released anyway. Closing a  SR early I is merely an optimization to free scarce resources as soon as possible. A SR has three invariants:  It is illegal to call T after a previous call returns W, or after a call to U.  It is illegal to call U% multiple times, or after a previous  T returns a W.  A SR2 is responsible to free any resources when either U  is called or a W- is returned. However, based on the usage of  ", this is simply an optimization.  Since 0.0.0 STUV=Result of pulling from a source. Either a new piece of data (Open), or " indicates that the source is now Closed.  Since 0.0.0 WXYTurn a KJ into a PO!. Note that in general this will  mean your original KJ# will be closed. Additionally, all * leftover data from usage of the returned Source will be discarded. In , other words: this is a no-going-back move. Note:  bufferSource . unbufferSource is not the identity function.  Since 0.0.1 "Note that this instance hides the N record, so that a  BufferedSource; remains resumable. The correct way to handle closing of a # resumable source would be to call  bsourceClose on the originally  BufferedSource, e.g.:  0 bsrc <- bufferSource $ sourceFile "myfile.txt"  bsrc $$ drop 5  rest <- bsrc $$ consume  bsourceClose bsrc Note that the call to the $$ operator allocates a new KJ  internally, so that when $$ calls  bsourceClose the first time, it does A not close the actual file, thereby allowing us to pass the same bsrc to  the consume& function. Afterwards, we should call  bsourceClose manually  (though  runResourceT$ will handle it for us eventually). FGHIJKLMNOPQRSTUVWXYFGGHIIJKLMNKLMNOPQPQRSTUSTUVXWWXY Z Construct a PO5 with some stateful functions. This function address  all mutable state for you.  Since 0.0.0 Initial state Pull function [ Construct a PO# based on some IO actions for alloc/ release.  Since 0.0.0  resource and/or state allocation  resource and/or state cleanup GPull function. Note that this need not explicitly perform any cleanup. \Transform the monad a PO lives in.  Since 0.0.0 Z[\Z[\ ]KThe connect operator, which pulls data from a source and pushes to a sink. 2 There are three ways this process can terminate:   In the case of a  SinkNoData* constructor, the source is not opened at 4 all, and the output value is returned immediately.  The sink returns Done3, in which case any leftover input is returned via   bsourceUnpull the source is closed.  The source return Closed$, in which case the sink is closed. -Note that the input source is converted to a KJ via  G5. As such, if the input to this function is itself a  KJ, the call to N will have no effect, as - described in the comments on that instance. ^HLeft fuse, combining a source and a conduit together into a new source. _ERight fuse, combining a conduit and a sink together into a new sink. `AMiddle fuse, combining two conduits together into a new conduit. 9Push some data to a conduit, then close it if necessary. F !%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`FVXWRSTUOPQJKLMNHIFGY79826345/01,.-()*+%&']^_`Z[\:;<BCD=E>A@?  !]^_` a Open a file / safely by automatically registering a release  action. #While you are not required to call hClose on the resulting handle, you = should do so as early as possible to free scarce resources.  Since 0.0.2 b.Stream the contents of a file as binary data.  Since 0.0.0 cStream the contents of a  as binary data. Note that this  function will not automatically close the Handle when processing ) completes, since it did not acquire the Handle in the first place.  Since 0.0.2. d&Stream all incoming data to the given . Note that this function  will not automatically close the Handle when processing completes.  Since 0.0.2. eFStream the contents of a file as binary data, starting from a certain < offset and only consuming up to a certain number of bytes.  Since 0.0.0 Offset Maximum count f,Stream all incoming data to the given file.  Since 0.0.0 gGStream the contents of the input to a file, and also send it along the 2 pipeline. Similar in concept to the Unix command tee.  Since 0.0.0 hJEnsure that only up to the given number of bytes are consume by the inner  sink. Note that this does not, ensure that all of those bytes are in fact  consumed.  Since 0.0.0 i4Return the next byte from the stream, if available.  Since 0.0.2 j-Return all bytes while the predicate returns True.  Since 0.0.2 k-Ignore all bytes while the predicate returns True.  Since 0.0.2 abcdefghijk bcefdghaijk abcdefghijklA strict left fold.  Since 0.0.0 mA monadic strict left fold.  Since 0.0.0 n.Apply the action to all values in the stream.  Since 0.0.0 oConvert a list into a source.  Since 0.0.0 pBIgnore a certain number of values in the stream. This function is  semantically equivalent to:   drop i = take i >> return ()  However, drop9 is more efficient as it does not need to hold values in  memory.  Since 0.0.0 qFTake some values from the stream and return as a list. If you want to ? instead create a conduit that pipes data to another sink, see z. . This function is semantically equivalent to:   take i = isolate i =$ consume  Since 0.0.0 r3Take a single value from the stream, if available.  Since 0.0.0 sKLook at the next value in the stream, if available. This function will not ! change the state of the stream.  Since 0.0.0 t2Apply a transformation to all values in a stream.  Since 0.0.0 u:Apply a monadic transformation to all values in a stream. MIf you do not need the transformed values, and instead just want the monadic ) side-effects of running the action, see n.  Since 0.0.0 vKApply a transformation to all values in a stream, concatenating the output  values.  Since 0.0.0 wHApply a monadic transformation to all values in a stream, concatenating  the output values.  Since 0.0.0 xHConsume all values from the stream and return as a list. Note that this ; will pull all values into memory. For a lazy variant, see  Data.Conduit.Lazy.  Since 0.0.0 y2Grouping input according to an equality function.  Since 0.0.2 zEEnsure that the inner sink consumes no more than the given number of  values. Note this this does not, ensure that the sink consumes all of those 2 values. To get the latter behavior, combine with |, e.g.:   src $$ do  x <- isolate count =$ do  x <- someSink  sinkNull  return x  someOtherSink  ...  Since 0.0.0 {:Keep only values in the stream passing a given predicate.  Since 0.0.0 |GIgnore the remainder of values in the source. Particularly useful when  combined with z.  Since 0.0.0 lmnopqrstuvwxyz{|olqprsx|mntvyz{uwlmnopqrstuvwxyz{| Since 0.0.0 }A specific character encoding.  Since 0.0.0 ~CConvert text into bytes, using the provided codec. If the codec is N not capable of representing an input character, an exception will be thrown.  Since 0.0.0 CConvert bytes into text, using the provided codec. If the codec is N not capable of decoding an input byte sequence, an exception will be thrown.  Since 0.0.0  Since 0.0.0  Since 0.0.0  Since 0.0.0  Since 0.0.0  Since 0.0.0  Since 0.0.0  Since 0.0.0 }~ }~ }~ Use lazy I/!O to consume all elements from a Source.  Since 0.0.0  !"#$%&'()*+,-./012234456789::;<=>?@ABC D E F G H I J K L M N O P Q R S T T U V W X X Y Z Z [ \ ] ^ _ ` a b cdefghijklmnopqrstuvwxpyz{|}~o             conduit-0.0.2Control.Monad.Trans.Resource Data.ConduitData.Conduit.BinaryData.Conduit.ListData.Conduit.TextData.Conduit.LazyData.Conduit.Types.ConduitData.Conduit.Types.SinkData.Conduit.Util.SinkData.Conduit.Util.ConduitData.Conduit.Types.SourceData.Conduit.Util.SourceSystem.PosixFile ResourceThrow resourceThrow ExceptionT runExceptionT ResourceT ReleaseKey ResourceIOResourceBaseIOsafeFromIOBaseResourceUnsafeIO unsafeFromIOResourceBaseresourceLiftBaseresourceBracket_HasRefRefnewRef'readRef' writeRef' modifyRef'maskmask_trynewRefreadRefwriteRef modifyRefwithwithIOregisterrelease runResourceTtransResourceTrunExceptionT_resourceForkIOConduitprepareConduitPreparedConduit conduitPush conduitClose ConduitResultFinished ProducingSink prepareSink PreparedSinkSinkDatasinkPush sinkClose SinkNoData SinkResultDone Processing sinkStatesinkIO transSink SequencedSinkSequencedSinkResponse StartConduitStopEmit conduitState conduitIO transConduit sequenceSink BufferSource bufferSourceSourceInvariantException PullAfterEOFBufferedSource bsourcePull bsourceUnpull bsourceCloseSource prepareSourcePreparedSource sourcePull sourceClose SourceResultClosedOpenunbufferSource sourceStatesourceIO transSource$$$==$=$=openFile sourceFile sourceHandle sinkHandlesourceFileRangesinkFile conduitFileisolatehead takeWhile dropWhilefoldfoldMmapM_ sourceListdroptakepeekmapmapM concatMap concatMapMconsumegroupByfiltersinkNullCodecencodedecodeutf8utf16_leutf16_beutf32_leutf32_beascii iso8859_1 lazyConsumebaseGHC.STST ReleaseMapNextKeyRefCountghc-prim GHC.TypesIOGHC.BaseMonadtransformers-base-0.4.1Control.Monad.BaseliftBase register'release' stateAlloc stateCleanup GHC.Exceptionthrow SinkState SinkEither SinkOutputSinkPair SinkCloseSinkPush Data.MaybeMaybe Data.EitherEithertoEither appHelper pushHelper closeHelperSCStateSCSink SCConduit SCNewStategoResscPushscCloseBStateBClosedBOpen Data.MonoidMonoid$fBufferSourceBufferedSourceFDFlagclosec_readc_openoRdonlyopenReadread FuseLeftStateFLOpenFLClosedconduitPushCloseGHC.IO.Handle.TypesHandle TextExceptionEncodeExceptionDecodeException codecName codecEncode codecDecode byteSplits splitSlowly utf16Requiredutf32SplitBytes tryEvaluate maybeDecode