A9l      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~None  !"<IN 4A space-efficient representation of a succession of 0 vectors, supporting many efficient operations. An effectful 8 contains 8-bit bytes, or by using the operations from Data.ByteString.Streaming.Char87 it can be interpreted as containing 8-bit characters.Smart constructor for ."Yield-style smart constructor for .Reconceive an effect that results in an effectful bytestring as an effectful bytestring. Compare Streaming.mwrap. The closes equivalent of 2Streaming.wrap :: f (Stream f m r) -> Stream f m r is here  consChunk. mwrap+ is the smart constructor for the internal Go constructor.CConstruct a succession of chunks from its Church encoding (compare GHC.Exts.build)Resolve a succession of chunks into its Church encoding; this is not a safe operation; it is equivalent to exposing the constructors VThe chunk size used for I/O. Currently set to 32k, less the memory management overhead TThe recommended chunk size. Currently set to 4k, less the memory management overhead EThe memory management overhead. Currently this is tuned for GHC only. vPacking and unpacking from lists packBytes' :: Monad m => [Word8] -> ByteString m () packBytes' cs0 = packChunks 32 cs0 where packChunks n cs = case S.packUptoLenBytes n cs of (bs, []) -> Chunk bs (Empty ()) (bs, cs') -> Chunk bs (packChunks (min (n * 2) BI.smallChunkSize) cs') -- packUptoLenBytes :: Int -> [Word8] -> (ByteString, [Word8]) packUptoLenBytes len xs0 = unsafeDupablePerformIO (createUptoN' len $ p -> go p len xs0) where go !_ !n [] = return (len-n, []) go !_ !0 xs = return (len, xs) go !p !n (x:xs) = poke p x >> go (p  1) (n-1) xs createUptoN' :: Int -> (Ptr Word8 -> IO (Int, a)) -> IO (S.ByteString, a) createUptoN' l f = do fp <- S.mallocByteString l (l', res)  -withForeignPtr fp $ p -C f p assert (l' <= l) $ return (S.PS fp 0 l', res) {-INLINABLE packBytes' -}HConsume the chunks of an effectful ByteString with a natural right fold.PConsume the chunks of an effectful ByteString with a natural right monadic fold.%       h(c) Don Stewart 2006 (c) Duncan Coutts 2006-2011 (c) Michael Thompson 2015 BSD-style#what_is_it_to_do_anything@yahoo.com experimentalportableNone!"INFO(n)& Concatenate a stream of byte streams.WGiven a byte stream on a transformed monad, make it possible to 'run' transformer.MPerform the effects contained in an effectful bytestring, ignoring the bytes.Perform the effects contained in the second in an effectful pair of bytestrings, ignoring the bytes. It would typically be used at the type 0 ByteString m (ByteString m r) -> ByteString m rO(1) The empty  -- i.e.  return () Note that ByteString m w0 is generally a monoid for monoidal values of w, like ()O(1) Yield a  as a minimal O(n)( Convert a monadic stream of individual s into a packed byte stream. O(n)A Converts a packed byte stream into a stream of individual bytes.!O(c)/ Convert a monadic stream of individual strict  chunks into a byte stream."O(c) Convert a byte stream into a stream of individual strict bytestrings. This of course exposes the internal chunk structure.#O(1) yield a strict  chunk. $O(n), Convert a byte stream into a single strict .Note that this is an  expensive operation that forces the whole monadic ByteString into memory and then copies all the data. If possible, try to avoid converting back and forth between streaming and strict bytestrings.%O(n)4 Convert a monadic byte stream into a single strict X, retaining the return value of the original pair. This operation is for use with . WmapsM R.toStrict :: Monad m => Stream (ByteString m) m r -> Stream (Of ByteString) m r FIt is subject to all the objections one makes to Data.ByteString.Lazy %$; all of these are devastating. &O(c)a Transmute a pseudo-pure lazy bytestring to its representation as a monadic stream of chunks.Q.putStrLn $ Q.fromLazy "hi"hiQ.fromLazy "hi"OChunk "hi" (Empty (())) -- note: a 'show' instance works in the identity monad<Q.fromLazy $ BL.fromChunks ["here", "are", "some", "chunks"]GChunk "here" (Chunk "are" (Chunk "some" (Chunk "chunks" (Empty (())))))'O(n)5 Convert an effectful byte stream into a single lazy 1 with the same internal chunk structure. See toLazyZ which preserve connectedness by keeping the return value of the effectful bytestring.(O(n)5 Convert an effectful byte stream into a single lazy V with the same internal chunk structure, retaining the original return value. 1This is the canonical way of breaking streaming (toStrict and the like are far more demonic). Essentially one is dividing the interleaved layers of effects and bytes into one immense layer of effects, followed by the memory of the succession of bytes. (Because one preserves the return value, toLazy is a suitable argument for  O S.mapsM Q.toLazy :: Stream (ByteString m) m r -> Stream (Of L.ByteString) m rQ.toLazy "hello" "hello" :> ()HS.toListM $ traverses Q.toLazy $ Q.lines "one\ntwo\nthree\nfour\nfive\n"9["one","two","three","four","five",""] -- [L.ByteString])O(1)\ Test whether an ByteString is empty. The value is of course in the monad of the effects.%Q.null "one\ntwo\three\nfour\nfive\n"FalseQ.null $ Q.take 0 Q.stdinTrue:t Q.null $ Q.take 0 Q.stdin0Q.null $ Q.take 0 Q.stdin :: MonadIO m => m Bool*6Remove empty ByteStrings from a stream of bytestrings.+O(1) Test whether a ByteString is empty, collecting its return value; -- to reach the return value, this operation must check the whole length of the string.%Q.null "one\ntwo\three\nfour\nfive\n" False :> () Q.null "" True :> ()3S.print $ mapsM R.null $ Q.lines "yours,\nMeredith"FalseFalse,O1q Distinguish empty from non-empty lines, while maintaining streaming; the empty ByteStrings are on the rightDnulls :: ByteString m r -> m (Sum (ByteString m) (ByteString m) r);There are many ways to remove null bytestrings from a Stream (ByteString m) m r (besides using denull). If we pass next to@mapsM nulls bs :: Stream (Sum (ByteString m) (ByteString m)) m rthen can then apply Streaming.separate to getNseparate (mapsM nulls bs) :: Stream (ByteString m) (Stream (ByteString m) m) rOThe inner monad is now made of the empty bytestrings; we act on this with hoist , considering that :t Q.effects . Q.concatQ.effects . Q.concat2 :: Monad m => Stream (Q.ByteString m) m r -> m rwe have 7hoist (Q.effects . Q.concat) . separate . mapsM Q.nullsK :: Monad n => Stream (Q.ByteString n) n b -> Stream (Q.ByteString n) n b.O(n/c) .+ returns the length of a byte stream as an E together with the return value. This makes various maps possible'Q.length "one\ntwo\three\nfour\nfive\n"23 :> ()LS.print $ S.take 3 $ mapsM Q.length $ Q.lines "one\ntwo\three\nfour\nfive\n"384/O(1) /! is analogous to '(:)' for lists.0O(1) Unlike /, 'cons\'' is strict in the ByteString that we are consing onto. More precisely, it forces the head and the first chunk. It does this because, for space efficiency, it may coalesce the new byte onto the first 'chunk' rather than starting a new 'chunk'.CSo that means you can't use a lazy recursive contruction like this: let xs = cons\' c xs in xsYou can however use / , as well as A and B", to build infinite byte streams.1O(n/c) Append a byte to the end of a 2O(1)D Extract the first element of a ByteString, which must be non-empty.3O(c)D Extract the first element of a ByteString, which must be non-empty.4O(1)F Extract the head and tail of a ByteString, or Nothing if it is empty5O(1) Extract the head and tail of a ByteString, or its return value if it is empty. This is the 'natural' uncons for an effectful byte stream.8O(n/c)O Extract the last element of a ByteString, which must be finite and non-empty.:O(n/c) Append two;O(n) ; f xs( is the ByteString obtained by applying f to each element of xs.==, applied to a binary operator, a starting value -- (typically the right-identity of the operator), and a ByteString, -- reduces the ByteString using the binary operator, from right to left. foldr cons = id>>, applied to a binary operator, a starting value (typically the left-identity of the operator), and a ByteString, reduces the ByteString using the binary operator, from left to right. We use the style of the foldl libarary for left folds?'fold\''s keeps the return value of the left-folded bytestring. Useful for simultaneous folds over a segmented bytestream@@ f x? returns an infinite ByteString of repeated applications -- of f to x: %iterate f x == [x, f x, f (f x), ...](R.stdout $ R.take 50 $ R.iterate succ 392()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXY,Q.putStrLn $ Q.take 50 $ Q.iterate succ '\''2()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYAA x! is an infinite ByteString, with x! the value of every element."R.stdout $ R.take 50 $ R.repeat 602<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<%Q.putStrLn $ Q.take 50 $ Q.repeat 'z'2zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzBB ties a finite ByteString into a circular one, or equivalently, the infinite repetition of the original ByteString. For an empty bytestring (like  return 17*) it of course makes an unproductive loop &Q.putStrLn $ Q.take 7 $ Q.cycle "y\n"yyyyCO(n) The D1 function is analogous to the Stream 'unfoldr'. DU builds a ByteString from a seed value. The function takes the element and returns 4 if it is done producing the ByteString or returns  (a,b), in which case, a( is a prepending to the ByteString and b2 is used as the next element in a recursive call.Dunfold is like D) but stops when the co-algebra returns O; the result is the return value of the 'ByteString m r' 'unfoldr uncons = id'EO(n/c) E n, applied to a ByteString xs, returns the prefix of xs of length n, or xs itself if n > . xs.JNote that in the streaming context this drops the final return value; G> preserves this information, and is sometimes to be preferred.8Q.putStrLn $ Q.take 8 $ "Is there a God?" >> return TrueIs there-Q.putStrLn $ "Is there a God?" >> return TrueIs there a God?TrueCrest <- Q.putStrLn $ Q.splitAt 8 $ "Is there a God?" >> return TrueIs thereQ.effects restTrueFO(n/c) F n xs returns the suffix of xs after the first n elements, or [] if n > . xs.!Q.putStrLn $ Q.drop 6 "Wisconsin"sin"Q.putStrLn $ Q.drop 16 "Wisconsin"GO(n/c) G n xs is equivalent to (E n xs, F n xs).\rest <- Q.putStrLn $ Q.splitAt 3 "therapist is a danger to good hyphenation, as Knuth notes"theQ.putStrLn $ Q.splitAt 19 restrapist is a danger HH, applied to a predicate p and a ByteString xs2, returns the longest prefix (possibly empty) of xs of elements that satisfy p.II p is equivalent to J ( . p).JJ p xs? breaks the ByteString into two segments. It is equivalent to (H p xs,  dropWhile p xs)KO(n) Splits a  into components delimited by separators, where the predicate returns True for a separator element. The resulting components do not contain the separators. Two adjacent separators result in an empty component in the output. eg. TsplitWith (=='a') "aabbaca" == ["","","bb","c",""] splitWith (=='a') [] == []LO(n) Break a K into pieces separated by the byte argument, consuming the delimiter. I.e. ~split '\n' "a\nb\nd\ne" == ["a","b","d","e"] split 'a' "aXaXaXa" == ["","X","X","X",""] split 'x' "x" == ["",""]and 9intercalate [c] . split c == id split == splitWith . (==)tAs for all splitting functions in this library, this function does not copy the substrings, it just constructs new  ByteStrings" that are slices of the original.MThe M function take`5s a ByteString and returns a list of ByteStrings such that the concatenation of the result is equal to the argument. Moreover, each sublist in the result contains only equal elements. For example, :group "Mississippi" = ["M","i","ss","i","ss","i","pp","i"]It is a special case of groupByA, which allows the programmer to supply their own equality test.NO(n) The N function takes a  and a list of es and concatenates the list after interspersing the first argument between each element of the list.OHcount returns the number of times its argument appears in the ByteString count = length . elemIndicesQO(n) Qy, applied to a predicate and a ByteString, returns a ByteString containing those characters that satisfy the predicate.RRead entire handle contents lazily into a ,. Chunks are read on demand, in at most k9-sized chunks. It does not block waiting for a whole k-sized chunk, so if less than kS bytes are available then they will be returned immediately as a smaller chunk.The handle is closed on EOF. Note: the * should be placed in binary mode with  for R to work correctly.SRead n bytes into a , directly from the specified , in chunks of size k.ThGetNonBlockingN is similar to R, except that it will never block waiting for data to become available, instead it returns only whatever data is available. Chunks are read on demand, in k-sized chunks.URead entire handle contents lazily into a >. Chunks are read on demand, using the default chunk size..Once EOF is encountered, the Handle is closed. Note: the * should be placed in binary mode with  for U to work correctly.VPipes-style nomenclature for UWPipes-style nomenclature for ]XRead n bytes into a , directly from the specified .YhGetNonBlocking is similar to X, except that it will never block waiting for data to become available, instead it returns only whatever data is available. If there is no data available to be read, Y returns .Note: on Windows and with Haskell implementation other than GHC, this function does not work correctly; it behaves identically to X.ZnRead an entire file into a chunked 'ByteString IO ()'. The Handle will be held open until EOF is encountered.[Write a  to a file.\ Append a  to a file.]9getContents. Equivalent to hGetContents stdin. Will read lazily^ Outputs a  to the specified ._Pipes nomenclature for ^`Pipes-style nomenclature for putStraA synonym for hPut, for compatibility<hPutStr :: Handle -> ByteString IO r -> IO r hPutStr = hPut\- | Write a ByteString to stdout putStr :: ByteString IO r -> IO r putStr = hPut IO.stdout/The interact function takes a function of type ByteString -> ByteString as its argument. The entire input from the standard input device is passed to this function as its argument, and the resulting string is output on the standard output device. %interact morph = stdout (morph stdin)o is a variant of findIndex, that returns the length of the string if no element is found, rather than Nothing.diTake a builder and convert it to a genuine streaming bytestring, using a specific allocation strategy.f6A simple construction of a builder from a byte stream.5let aaa = "10000 is a number\n" :: Q.ByteString IO ()'hPutBuilder IO.stdout $ toBuilder aaa10000 is a numberS !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefT !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefT &('!"#%$;N</01:Q45*67IFMJGKEHLdcfeA@BCD=>?3298.-+,)PO]W`aZ[\V_XURSYT^bS !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefNoneINhO(n)C Convert a stream of separate characters into a packed byte stream.iO(1) Cons a  onto a byte stream.jO(1) Yield a  as a minimal kO(1) Unlike i, 'cons\'' is strict in the ByteString that we are consing onto. More precisely, it forces the head and the first chunk. It does this because, for space efficiency, it may coalesce the new byte onto the first 'chunk' rather than starting a new 'chunk'.CSo that means you can't use a lazy recursive contruction like this: let xs = cons\' c xs in xsYou can however use i , as well as w and B&, to build infinite lazy ByteStrings.lO(n/c) Append a byte to the end of a mO(1)D Extract the first element of a ByteString, which must be non-empty.nO(1)B Extract the first element of a ByteString, which may be non-emptyoO(n/c)O Extract the last element of a ByteString, which must be finite and non-empty.qO(1)N Extract the head and tail of a ByteString, returning Nothing if it is empty.rO(n) r f xs( is the ByteString obtained by applying f to each element of xs.vv f x= returns an infinite ByteString of repeated applications of f to x:ww x! is an infinite ByteString, with x the value of every element.xBt ties a finite ByteString into a circular one, or equivalently, the infinite repetition of the original ByteString.| O(n) The y1 function is analogous to the Stream 'unfoldr'. yU builds a ByteString from a seed value. The function takes the element and returns 4 if it is done producing the ByteString or returns  (a,b), in which case, a( is a prepending to the ByteString and b2 is used as the next element in a recursive call.zz, applied to a predicate p and a ByteString xs2, returns the longest prefix (possibly empty) of xs of elements that satisfy p.{{ p is equivalent to | ( . p).|| p xs? breaks the ByteString into two segments. It is equivalent to (z p xs,  dropWhile p xs)~O(n) Break a O into pieces separated by the byte argument, consuming the delimiter. I.e. ~split '\n' "a\nb\nd\ne" == ["a","b","d","e"] split 'a' "aXaXaXa" == ["","X","X","X",""] split 'x' "x" == ["",""]and 9intercalate [c] . split c == id split == splitWith . (==)sAs for all splitting functions in this library, this function does not copy the substrings, it just constructs new  ByteStrings! that are slices of the original.0Q.stdout $ Q.unlines $ Q.split 'n' "banana peel"baaa peelO(n) y, applied to a predicate and a ByteString, returns a ByteString containing those characters that satisfy the predicate. turns a ByteString into a connected stream of ByteStrings at divide at newline characters. The resulting strings do not contain newlines. This is the genuinely streaming L which only breaks chunks, and thus never increases the use of memory. ?lines :: Monad m => ByteString m r -> Stream (ByteString m) m rThe . function restores line breaks between layers  breaks a byte stream up into a succession of byte streams corresponding to words, breaking Chars representing white space. This is the genuinely streaming p. A function that returns individual strict bytestrings would concatenate even infinitely long words like  cycle "y" in memory. It is best for the user who has reflected on her materials to write `mapsM toStrict . words` or the like, if strict bytestrings are needed.The  function is analogous to the  function, on words.MThis will read positive or negative Ints that require 18 or fewer characters.$ghijklmnopqrstuvwxyz{|}~\!"#$%&'()*+,-.67:BEFGMNRSTUVWXYZ[\]^_`acdefghijklmnopqrstuvwxyz{|}~\hgj!&#"('%$rNsikl:nmpo+,q67{FM|G}Ez~*cdfewvByxut.-)]W`aZ[\V_XURSYT^$ghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijkl&%5$6789>?:ABEDFGIJNOPQRWmnopqUVrstuvwxvyz{{|}~vvvvstrea_8hQ5Nzem95K9FqHYxRUiqd"Data.ByteString.Streaming.InternalData.ByteString.StreamingData.ByteString.Streaming.Char8 System.IOhSetBinaryMode ByteStringEmptyChunkGo consChunkchunkmwrap materialize dematerializedefaultChunkSizesmallChunkSize chunkOverhead packBytes packChars unpackBytes unsafeLastinlinePerformIO foldrChunks foldlChunks foldlChunksM foldrChunksM unfoldrNE unfoldMChunks unfoldrChunksrereadconcat distributeeffectsdrainedempty singletonpackunpack fromChunkstoChunks fromStrict toStrict_toStrictfromLazytoLazy_toLazynull_denullnullnullslength_lengthconscons'snochead_headunconsnextByte unconsChunk nextChunklast_lastappendmap interspersefoldrfoldfold_iteraterepeatcycleunfoldMunfoldrtakedropsplitAt takeWhilebreakspan splitWithsplitgroup intercalatecount_countfilter hGetContentsNhGetNhGetNonBlockingN hGetContents fromHandlestdinhGethGetNonBlockingreadFile writeFile appendFile getContentshPuttoHandlestdoutinteract zipWithStreamtoStreamingByteStringtoStreamingByteStringWithconcatBuilders toBuilderlinesunlineswordsunwordsstringnextCharputStrputStrLnreadIntbaseGHC.WordWord8GHC.PtrplusPtrSPECSPEC2$fMonoidByteString$fShowByteString$fIsStringByteString$fMFunctorByteString$fMonadTransByteString$fMonadIOByteString$fMonadByteString$fApplicativeByteString$fFunctorByteStringstrea_EIIQy3MKSQKCNMFNd2T380Streaming.InternalmapsMghc-prim GHC.TypesIntGHC.BaseNothingJust Data.EitherLeft GHC.ClassesnotGHC.IO.Handle.TypesHandlefindIndexOrEnd isPrefixOfillegalBufferSizerevNonEmptyChunks revChunksChar