5)-      !"#$%&'()*+,-./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 .Smart constructor for .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!"IN@O(n)& Concatenate a stream of byte streams.WGiven a byte stream on a transformed monad, make it possible to 'run' transformer.O(1) The empty  -- i.e. return ()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 . XmapsM R.toStrict' :: Monad m => Stream (ByteString m) m r -> Stream (Of ByteString) m r 1It is subject to all the objections one makes to ". $O(c)U Transmute a 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)2 Convert a monadic byte stream into a single lazy , with the same internal chunk structure.Q.toLazy "hello""hello"&O(n)2 Convert a monadic byte stream into a single lazy W with the same invisible chunk structure, retaining the original return value. Q.toLazy' "hello" "hello" :> ()FS.toListM $ mapsM Q.toLazy' $ Q.lines $ "one\ntwo\three\nfour\nfive\n"$["one","two\three","four","five",""]'O(1)N Test whether a ByteString is empty. The value is of course in the base monad.%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(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 :> ()[*Main] Q.null' "" True :> ()4S.print $ mapsM R.null' $ Q.lines "yours,\nMeredith"FalseFalse*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 :> ()MS.print $ S.take 3 $ mapsM Q.length' $ Q.lines "one\ntwo\three\nfour\nfive\n"384+O(1) +! is analogous to '(:)' for lists.,O(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 = and >", to build infinite byte streams.-O(n/c) Append a byte to the end of a .O(1)D Extract the first element of a ByteString, which must be non-empty./O(c)D Extract the first element of a ByteString, which must be non-empty.0O(1)F Extract the head and tail of a ByteString, or Nothing if it is empty1O(1)O Extract the head and tail of a ByteString, or its return value if it is empty4O(n/c)O Extract the last element of a ByteString, which must be finite and non-empty.6O(n/c) Append two7O(n) 7 f xs( is the ByteString obtained by applying f to each element of xs.99, 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<O(n)K Concatenate a list of ByteStrings. concat :: (Monad m) => [ByteString m ()] -> ByteString m () concat css0 = to css0 where go css (Empty m') = to css go css (Chunk c cs) = Chunk c (go css cs) go css (Go m) = Go (liftM (go css) m) to [] = Empty () to (cs:css) = go css cs< 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 396()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXY>>> ,Q.putStrLn $ Q.take 50 $ Q.iterate succ '\''2()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXY== x! is an infinite ByteString, with x! the value of every element."R.stdout $ R.take 50 $ R.repeat 606<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>> %Q.putStrLn $ Q.take 50 $ Q.repeat 'z'2zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz>> 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"yyyy?O(n) The @1 function is analogous to the Stream 'unfoldr'. @U 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.@unfold is like @) but stops when the co-algebra returns O; the result is the return value of the 'ByteString m r' 'unfoldr uncons = id'AO(n/c) A 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; C> 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 there Q.drain restTrueBO(n/c) B 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"CO(n/c) C n xs is equivalent to (A n xs, B 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 DD, applied to a predicate p and a ByteString xs2, returns the longest prefix (possibly empty) of xs of elements that satisfy p.EE p is equivalent to F ( . p).FF p xs? breaks the ByteString into two segments. It is equivalent to (D p xs,  dropWhile p xs)GO(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') [] == []HO(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.IThe I 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.JO(n) The J function takes a  and a list of es and concatenates the list after interspersing the first argument between each element of the list.KHcount returns the number of times its argument appears in the ByteString count = length . elemIndicesMO(n) My, applied to a predicate and a ByteString, returns a ByteString containing those characters that satisfy the predicate.NRead entire handle contents lazily into a ). Chunks are read on demand, in at most k6-sized chunks. It does not block waiting for a whole k-sized chunk, so if less than kP 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 N to work correctly.ORead n bytes into a , directly from the specified , in chunks of size k.PhGetNonBlockingN is similar to N, 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.QRead 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 Q to work correctly.RPipes-style nomenclature for QSPipes-style nomenclature for YTRead n bytes into a , directly from the specified .UhGetNonBlocking is similar to T, 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, U returns .Note: on Windows and with Haskell implementation other than GHC, this function does not work correctly; it behaves identically to T.VnRead an entire file into a chunked 'ByteString IO ()'. The Handle will be held open until EOF is encountered.WWrite a  to a file.X Append a  to a file.Y9getContents. Equivalent to hGetContents stdin. Will read lazilyZ Outputs a  to the specified .[Pipes nomenclature for Z\Pipes-style nomenclature for putStr] Similar to Zj except that it will never block. Instead it returns any tail that did not get written. This tail may be  in the case that the whole string was written, or the whole original string if nothing was written. Partial writes are also possible.Note: on Windows and with Haskell implementation other than GHC, this function does not work correctly; it behaves identically to Z.hPutNonBlocking :: MonadIO m => Handle -> ByteString m r -> ByteString m r hPutNonBlocking _ (Empty r) = Empty r hPutNonBlocking h (Go m) = Go $ liftM (hPutNonBlocking h) m hPutNonBlocking h bs@(Chunk c cs) = do c' <- lift $ S.hPutNonBlocking h c case S.length c' of l' | l' == S.length c -> hPutNonBlocking h cs 0 -> bs _ -> Chunk c' cs {- INLINABLE hPutNonBlocking -}A 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.stdouto is a variant of findIndex, that returns the length of the string if no element is found, rather than Nothing.K !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^M !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^M$%& !"#7J8+,-6M0123EBIFCGADH=<>?@9:;./45)*'(KLYS\]VWXR[TQNOUPZ^K !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^NoneIN`O(n)C Convert a stream of separate characters into a packed byte stream.aO(1) Cons a  onto a byte stream.bO(1) Yield a  as a minimal cO(1) Unlike a, '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 a , as well as o and >&, to build infinite lazy ByteStrings.dO(n/c) Append a byte to the end of a eO(1)D Extract the first element of a ByteString, which must be non-empty.fO(1)B Extract the first element of a ByteString, which may be non-emptygO(n/c)O Extract the last element of a ByteString, which must be finite and non-empty.iO(1)N Extract the head and tail of a ByteString, returning Nothing if it is empty.jO(n) j f xs( is the ByteString obtained by applying f to each element of xs.nn f x= returns an infinite ByteString of repeated applications of f to x:oo x! is an infinite ByteString, with x the value of every element.p>t ties a finite ByteString into a circular one, or equivalently, the infinite repetition of the original ByteString.| O(n) The q1 function is analogous to the Stream 'unfoldr'. qU 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.rr, applied to a predicate p and a ByteString xs2, returns the longest prefix (possibly empty) of xs of elements that satisfy p.ss p is equivalent to t ( . p).tt p xs? breaks the ByteString into two segments. It is equivalent to (r p xs,  dropWhile p xs)vO(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 peelwO(n) wy, applied to a predicate and a ByteString, returns a ByteString containing those characters that satisfy the predicate.xx 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 x which only breaks chunks, and thus never increases the use of memory. It is crucial to distinguish its type from that of z linesIndividual :: Monad m => ByteString m r -> Stream (Of B.ByteString) m r lines :: Monad m => ByteString m r -> Stream (ByteString m) m ryThe y. function restores line breaks between layers zz? breaks streaming by concatening the chunks between line breaks )linesIndividual = mapsM toStrict' . lines|| breaks a byte stream up into a succession of byte streams corresponding to words, breaking Chars representing white space. This is the genuinely streaming | to be distinguished from ~G, which will attempt to concatenate even infinitely long words like  cycle "y" in memory.}The } function is analogous to the y function, on words.~~8 breaks a bytestream into a sequence of individual Data.ByteString.ByteStrings, delimited by Chars representing white space. It involves concatenation, of course, and is thus potentially unsafe. Distinguish the types wordsIndividual :: Monad m => ByteString m r -> Stream (Of B.ByteString) m r words :: Monad m => ByteString m r -> Stream (ByteString m) m r!The latter, genuinely streaming, |f can only break up chunks hidden in the stream that is given; the former potentially concatenates )wordsIndividual = mapsM toStrict' . words returns to a genuine bytestream by interspersing white space between a sequence of individual Data.ByteString.ByteString Distinguish the types unwordsIndividual :: Monad m => Stream (Of B.ByteString) m r -> ByteString m r unwords :: Monad m => Stream (ByteString m) m r -> ByteString m r'_`abcdefghijklmnopqrstuvwxyz{|}~X !"#$%&'()*236>ABCIJNOPQRSTUVWXYZ[\]_`abcdefghijklmnopqrstuvwxyz{|}~X`_y}{b$! %&"#jJkacd6wefgh'(i23sBItCuArvx|z~on>qplm)*YS\]VWXR[TQNOUPZ'_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcd$#1"2345:;6=>@ABCEFJKLMNSefghijklmQRnopqrsqtuvvwxyz{|}~qqqqstrea_05AA5iYby6G7Y3y5YBJldP"Data.ByteString.Streaming.InternalData.ByteString.StreamingData.ByteString.Streaming.Char8 System.IOhSetBinaryMode ByteStringEmptyChunkGo consChunkchunkwrap materialize dematerializedefaultChunkSizesmallChunkSize chunkOverhead packBytes packChars unpackBytesinlinePerformIO foldrChunks foldlChunks foldlChunksM foldrChunksM unfoldrNE unfoldMChunks unfoldrChunksrereadconcat distributedrainempty singletonpackunpack fromChunkstoChunks fromStricttoStrict toStrict'fromLazytoLazytoLazy'nullnull'lengthlength'conscons'snocheadhead'unconsnextByte unconsChunk nextChunklastlast'appendmap interspersefoldrfoldfold'iteraterepeatcycleunfoldMunfoldrtakedropsplitAt takeWhilebreakspan splitWithsplitgroup intercalatecountcount'filter hGetContentsNhGetNhGetNonBlockingN hGetContents fromHandlestdinhGethGetNonBlockingreadFile writeFile appendFile getContentshPuttoHandlestdoutinteract zipWithStreamlinesunlineslinesIndividualunlinesIndividualwordsunwordswordsIndividualunwordsIndividualstringnextCharputStrputStrLnbaseGHC.WordWord8GHC.PtrplusPtrSPECSPEC2$fMonoidByteString$fShowByteString$fIsStringByteString$fMFunctorByteString$fMonadTransByteString$fMonadIOByteString$fMonadByteString$fApplicativeByteString$fFunctorByteStringstrea_5ANEcNaifFx402YM8sLpiEStreaming.InternalmapsMghc-prim GHC.TypesIntGHC.BaseNothingJust Data.EitherLeft GHC.ClassesnotGHC.IO.Handle.TypesHandlefindIndexOrEndillegalBufferSizerevNonEmptyChunks revChunksChar