!"#$%&'()*+,-./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'. 3For monads supporting multi-threaded access (e.g., IO), this much be  an atomic modification. Create a new reference. Read a value from a reference. Write a value to a reference. 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 1)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 /01KIn 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 5 constructor. For the  second, the 25 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 /. implementation M cannot always produce output, this should be indicated in its return value,  using something like a  or .  Invariants:  After a 1 produces a result (either via 3 or  47), 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 23456A 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 78 ./012345678 ./0/015234234568778 9 Construct a /.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 /.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 /. lives in.  Since 0.0.0 9:;9:; <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. @+Set a new state, and emit some new output. A 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. B 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. CTransform the monad a %$ lives in.  Since 0.0.0 D Convert a < into a %$.  Since 0.0.0 initial state <=>?@ABCD <=@?>>?@ABCD E Since 0.0.0 FGAll but the simplest of KJ 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 KJ4 is given no opportunity to acquire such resources,  this type is. A HG+ is simply a monadic action that returns a KJ. 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 HG. 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 BufferedSource.  Since 0.0.0 HIJA KJ9 has two operations on it: pull some data, and close the  KJ. Since KJ is built on top of , all G acquired resources should be automatically released anyway. Closing a  KJ early I is merely an optimization to free scarce resources as soon as possible. A KJ has three invariants:  It is illegal to call L after a previous call returns O, or after a call to M.  It is illegal to call M% multiple times, or after a previous  L returns a O.  A KJ2 is responsible to free any resources when either M  is called or a O- is returned. However, based on the usage of  ", this is simply an optimization.  Since 0.0.0 KLMN=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 OP EFGHIJKLMNOP EFFGHIHIJKLMKLMNPOOP Q Construct a HG5 with some stateful functions. This function address  all mutable state for you.  Since 0.0.0 Initial state Pull function R Construct a HG# 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. STransform the monad a HG lives in.  Since 0.0.0 QRSQRS TWhen actually interacting with HG!s, we usually want to be able to K buffer the output, in case any intermediate steps return leftover data. A  T allows for such buffering. A T , unlike a HG,, is resumable, meaning it can be passed to  multiple /.s without restarting.  Finally, a T$ relaxes one of the invariants of a HG: 3 pulling after an the source is closed is allowed. 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 U/A typeclass allowing us to unify operators for HG and  T. VKThe 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. 5Note that this function will automatically close any HGs, but will not  close any Ts, allowing them to be reused.  Since 0.0.0 WHLeft fuse, combining a source and a conduit together into a new source.  Since 0.0.0 XERight fuse, combining a conduit and a sink together into a new sink.  Since 0.0.0 YAMiddle fuse, combining two conduits together into a new conduit.  Since 0.0.0 9Push some data to a conduit, then close it if necessary. Z Prepare a HG8 and initialize a buffer. Note that you should manually  call \ when the T is no longer in use.  Since 0.0.0 [Turn a T into a HG!. Note that in general this will  mean your original T# 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 \Close the underlying KJ for the given T. Note J that this function can safely be called multiple times, as it will first  check if the KJ was previously closed.  Since 0.0.0 C  $%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\CNPOJKLMGHIEFTZ[\U68715234./0+-,'()*$%&VWXYQRS9:;ABC<D=@?>   TUVWXYZ[\]A strict left fold.  Since 0.0.0 ^A monadic strict left fold.  Since 0.0.0 _.Apply the action to all values in the stream.  Since 0.0.0 `Convert a list into a source.  Since 0.0.0 aBIgnore 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 bFTake 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 k. . This function is semantically equivalent to:   take i = isolate i =$ consume  Since 0.0.0 c3Take a single value from the stream, if available.  Since 0.0.0 dKLook at the next value in the stream, if available. This function will not ! change the state of the stream.  Since 0.0.0 e2Apply a transformation to all values in a stream.  Since 0.0.0 f: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 _.  Since 0.0.0 gKApply a transformation to all values in a stream, concatenating the output  values.  Since 0.0.0 hHApply a monadic transformation to all values in a stream, concatenating  the output values.  Since 0.0.0 iHConsume 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 j2Grouping input according to an equality function.  Since 0.0.2 kEEnsure 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 m, e.g.:   src $$ do  x <- isolate count =$ do  x <- someSink  sinkNull  return x  someOtherSink  ...  Since 0.0.0 l:Keep only values in the stream passing a given predicate.  Since 0.0.0 mGIgnore the remainder of values in the source. Particularly useful when  combined with k.  Since 0.0.0 nHA source that returns nothing. Note that this is just a type-restricted  synonym for .  Since 0.0.4 ]^_`abcdefghijklmn`n]bacdim^_egjklfh]^_`abcdefghijklmn o 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 p.Stream the contents of a file as binary data.  Since 0.0.0 qStream 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. r&Stream all incoming data to the given . Note that this function  will not automatically close the Handle when processing completes.  Since 0.0.2. sFStream 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 t,Stream all incoming data to the given file.  Since 0.0.0 uGStream 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 vJEnsure 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 w4Return the next byte from the stream, if available.  Since 0.0.2 x-Return all bytes while the predicate returns True.  Since 0.0.2 y-Ignore all bytes while the predicate returns True.  Since 0.0.2 z.Take the given number of bytes, if available.  Since 0.0.3 opqrstuvwxyz pqstruvowxyz opqrstuvwxyz 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  !"#$%&'()*+,-./0112334567899:;<=>?@AB C D E F G H I J K L M N O P Q Q R S S T U V W X Y Z [\]^_`abcdefghijklmnopqrstuvwxyz{|}sk~j          \ conduit-0.1.0Control.Monad.Trans.Resource Data.ConduitData.Conduit.ListData.Conduit.BinaryData.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'atomicModifyRef'maskmask_trynewRefreadRefwriteRefwithwithIOregisterrelease runResourceTtransResourceTrunExceptionT_resourceForkIOConduitprepareConduitPreparedConduit conduitPush conduitClose ConduitResultFinished ProducingSink prepareSink PreparedSinkSinkDatasinkPush sinkClose SinkNoData SinkResultDone Processing sinkStatesinkIO transSink SequencedSinkSequencedSinkResponse StartConduitStopEmit conduitState conduitIO transConduit sequenceSinkSourceInvariantException PullAfterEOFSource prepareSourcePreparedSource sourcePull sourceClose SourceResultClosedOpen sourceStatesourceIO transSourceBufferedSourceIsSource$$$==$=$= bufferSourceunbufferSource bsourceClosefoldfoldMmapM_ sourceListdroptakeheadpeekmapmapM concatMap concatMapMconsumegroupByisolatefiltersinkNull sourceNullopenFile sourceFile sourceHandle sinkHandlesourceFileRangesinkFile conduitFile takeWhile dropWhileCodecencodedecodeutf8utf16_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 SCNewStategoResscPushscClose Data.MonoidMonoidFDFlagclosec_readc_openoRdonlyopenReadreadBSStateOpenFull ClosedFull OpenEmpty ClosedEmptybsSourcebsBuffer FuseLeftStateFLOpenFLClosedconnectfuseLeft normalConnectnormalFuseLeftconduitPushClosebufferedConnectbufferedFuseLeft bsourcePull bsourceUnpullmemptyGHC.IO.Handle.TypesHandle TextExceptionEncodeExceptionDecodeException codecName codecEncode codecDecode byteSplits splitSlowly utf16Requiredutf32SplitBytes tryEvaluate maybeDecode