h$MAL     2019 James BrockBSD2"James Brock None&replace-attoparsec Break on and capture one patternFind the first occurence of a pattern in a text stream, capture the found pattern, and break the input text stream on the found pattern.The  function is like , but can be predicated beyond more than just the next one token. It's also like  , but the needle/ can be a pattern instead of a constant string..Be careful not to look too far ahead; if the sep+ parser looks to the end of the input then  could be O(n).The pattern parser sep may match a zero-width pattern (a pattern which consumes no parser input on success).OutputNothing! when no pattern match was found.#Just (prefix, parse_result, suffix): for the result of parsing the pattern match, and the prefix string before and the suffix% string after the pattern match. prefix and suffix may be zero-length strings."Access the matched section of textIf you want to capture the matched string, then combine the pattern parser sep with  .With the matched string, we can reconstruct the input string. For all input, sep, if let (+ (prefix, (infix, _), suffix)) = breakCap (  sep) input then input == prefix  infix  suffix replace-attoparsec!Split on and capture all patterns#Find all occurences of the pattern sep, split the input string, capture all the patterns and the splits.The input string will be split on every leftmost non-overlapping occurence of the pattern sep. The output list will contain the parsed result of input string sections which match the sep pattern in , and non-matching sections in . depends on , see  for more details."Access the matched section of textIf you want to capture the matched strings, then combine the pattern parser sep with  .With the matched strings, we can reconstruct the input string. For all input, sep, if let output = splitCap (  sep) input then  input ==   (    output) replace-attoparsec Stream editorAlso known as @find-and-replace@, or @match-and-substitute@. Finds all of the sections of the stream which match the pattern sep,, and replaces them with the result of the editor function.*Access the matched section of text in the editor0If you want access to the matched string in the editor, function, then combine the pattern parser sep with  0. This will effectively change the type of the editor function to (ByteString,a) -> ByteString.This allows us to write an editor function which can choose to not edit the match and just leave it as it is. If the editor5 function returns the first item in the tuple, then  streamEdit% will not change the matched string. So, for all sep:  streamEdit (  sep)   D  replace-attoparsec Stream editorMonad transformer version of .The editor3 function will run in the underlying monad context.If you want to do  operations in the editor function then run this in .If you want the editor function to remember some state, then run this in a stateful monad.replace-attoparsec Specialized http://hackage.haskell.org/package/parser-combinators/docs/Control-Monad-Combinators.html#v:manyTill_ manyTill_9Parser combinator to consume and capture input until the sep" pattern matches, equivalent to   sep. On success, returns the prefix before the pattern match and the parsed match.sep may be a zero-width parser, it may succeed without consuming any input.7This combinator will produce a parser which acts like  but is predicated beyond more than just the next one token. It is also like , in that it is a @high performance@ parser.replace-attoparsecSeparate and captureParser combinator to find all of the non-overlapping ocurrences of the pattern sep in a text stream. The  parser will always consume its entire input and can never fail.sepCap is similar to the sep* family of functions found in  http://hackage.haskell.org/package/parser-combinators/docs/Control-Monad-Combinators.htmlparser-combinators and  http://hackage.haskell.org/package/parsers/docs/Text-Parser-Combinators.htmlparsers+, but it returns the parsed result of the sep% parser instead of throwing it away.OutputThe input stream is separated and output into a list of sections:)Sections which can parsed by the pattern sep# will be parsed and captured as 8Non-matching sections of the stream will be captured in .*The output list also has these properties:If the input is "" then the output list will be [].If there are no pattern matches, then the entire input stream will be returned as one non-matching  section.1The output list will not contain two consecutive  sections.Zero-width matches forbiddenIf the pattern matching parser sep1 would succeed without consuming any input then % will force it to fail. If we allow sep to match a zero-width pattern, then it can match the same zero-width pattern again at the same position on the next iteration, which would result in an infinite number of overlapping pattern matches.replace-attoparsec6Find all occurences, parse and capture pattern matchesParser combinator for finding all occurences of a pattern in a stream. Will call  with the  ? combinator so that the text which matched the pattern parser sep will be returned in the 1 sections, along with the result of the parse of sep. Definition: findAllCap sep =  (  sep) replace-attoparsecFind all occurencesParser combinator for finding all occurences of a pattern in a stream. Will call  with the   combinator and return the text which matched the pattern parser sep in the  sections. Definition: findAll sep = (fmap.fmap) ( fst) $  (  sep) replace-attoparsecThe pattern matching parser sepreplace-attoparsecThe input stream of textreplace-attoparsec$Maybe (prefix, parse_result, suffix)replace-attoparsecThe pattern matching parser sepreplace-attoparsecThe input stream of textreplace-attoparsec0List of matching and non-matching input sectionsreplace-attoparsecThe pattern matching parser sepreplace-attoparsecThe editor$ function. Takes a parsed result of sep7 and returns a new stream section for the replacement.replace-attoparsec%The input stream of text to be editedreplace-attoparsecThe edited input streamreplace-attoparsecThe pattern matching parser sepreplace-attoparsecThe editor$ function. Takes a parsed result of sep7 and returns a new stream section for the replacement.replace-attoparsec%The input stream of text to be editedreplace-attoparsecThe edited input streamreplace-attoparsecThe pattern matching parser sepreplace-attoparsecparserreplace-attoparsecThe pattern matching parser sepreplace-attoparsecparserreplace-attoparsecThe pattern matching parser sepreplace-attoparsecparserreplace-attoparsecThe pattern matching parser sepreplace-attoparsecparser2019 James BrockBSD2"James Brock None=replace-attoparsec Break on and capture one patternFind the first occurence of a pattern in a text stream, capture the found pattern, and break the input text stream on the found pattern.The  function is like , but can be predicated beyond more than just the next one token. It's also like  , but the needle/ can be a pattern instead of a constant string..Be careful not to look too far ahead; if the sep+ parser looks to the end of the input then  could be O(n).The pattern parser sep may match a zero-width pattern (a pattern which consumes no parser input on success).OutputNothing! when no pattern match was found.#Just (prefix, parse_result, suffix): for the result of parsing the pattern match, and the prefix string before and the suffix% string after the pattern match. prefix and suffix may be zero-length strings."Access the matched section of textIf you want to capture the matched string, then combine the pattern parser sep with  .With the matched string, we can reconstruct the input string. For all input, sep, if let (+ (prefix, (infix, _), suffix)) = breakCap (  sep) input then input == prefix  infix  suffix replace-attoparsec!Split on and capture all patterns#Find all occurences of the pattern sep, split the input string, capture all the patterns and the splits.The input string will be split on every leftmost non-overlapping occurence of the pattern sep. The output list will contain the parsed result of input string sections which match the sep pattern in , and non-matching sections in .  depends on  , see   for more details."Access the matched section of textIf you want to capture the matched strings, then combine the pattern parser sep with  .With the matched strings, we can reconstruct the input string. For all input, sep, if let output = splitCap (  sep) input then  input ==   (    output) replace-attoparsec Stream editorAlso known as @find-and-replace@, or @match-and-substitute@. Finds all of the sections of the stream which match the pattern sep,, and replaces them with the result of the editor function.*Access the matched section of text in the editor0If you want access to the matched string in the editor, function, then combine the pattern parser sep with  0. This will effectively change the type of the editor function to (Text,a) -> Text.This allows us to write an editor function which can choose to not edit the match and just leave it as it is. If the editor5 function returns the first item in the tuple, then  streamEdit% will not change the matched string. So, for all sep:  streamEdit (  sep)   D  replace-attoparsec Stream editorMonad transformer version of  .The editor3 function will run in the underlying monad context.If you want to do  operations in the editor function then run this in .If you want the editor function to remember some state, then run this in a stateful monad. replace-attoparsec Specialized http://hackage.haskell.org/package/parser-combinators/docs/Control-Monad-Combinators.html#v:manyTill_ manyTill_9Parser combinator to consume and capture input until the sep" pattern matches, equivalent to   sep. On success, returns the prefix before the pattern match and the parsed match.sep may be a zero-width parser, it may succeed without consuming any input.7This combinator will produce a parser which acts like  but is predicated beyond more than just the next one token. It is also like + in that it is a @high performance@ parser. replace-attoparsecSeparate and captureParser combinator to find all of the non-overlapping ocurrences of the pattern sep in a text stream. The   parser will always consume its entire input and can never fail.  is similar to the sep* family of functions found in  http://hackage.haskell.org/package/parser-combinators/docs/Control-Monad-Combinators.htmlparser-combinators and  http://hackage.haskell.org/package/parsers/docs/Text-Parser-Combinators.htmlparsers+, but it returns the parsed result of the sep% parser instead of throwing it away.OutputThe input stream is separated and output into a list of sections:)Sections which can parsed by the pattern sep# will be parsed and captured as 8Non-matching sections of the stream will be captured in .*The output list also has these properties:If the input is "" then the output list will be [].If there are no pattern matches, then the entire input stream will be returned as one non-matching  section.1The output list will not contain two consecutive  sections.Zero-width matches forbiddenIf the pattern matching parser sep1 would succeed without consuming any input then  % will force it to fail. If we allow sep to match a zero-width pattern, then it can match the same zero-width pattern again at the same position on the next iteration, which would result in an infinite number of overlapping pattern matches.replace-attoparsec6Find all occurences, parse and capture pattern matchesParser combinator for finding all occurences of a pattern in a stream. Will call   with the  ? combinator so that the text which matched the pattern parser sep will be returned in the 1 sections, along with the result of the parse of sep. Definition: findAllCap sep =   (  sep) replace-attoparsecFind all occurencesParser combinator for finding all occurences of a pattern in a stream. Will call   with the   combinator and return the text which matched the pattern parser sep in the  sections. Definition: findAll sep = (fmap.fmap) ( fst) $   (  sep) replace-attoparsecThe pattern matching parser sepreplace-attoparsecThe input stream of textreplace-attoparsec$Maybe (prefix, parse_result, suffix) replace-attoparsecThe pattern matching parser sepreplace-attoparsecThe input stream of textreplace-attoparsec0List of matching and non-matching input sections replace-attoparsecThe pattern matching parser sepreplace-attoparsecThe editor$ function. Takes a parsed result of sep7 and returns a new stream section for the replacement.replace-attoparsec%The input stream of text to be editedreplace-attoparsecThe edited input stream replace-attoparsecThe pattern matching parser sepreplace-attoparsecThe editor$ function. Takes a parsed result of sep7 and returns a new stream section for the replacement.replace-attoparsec%The input stream of text to be editedreplace-attoparsecThe edited input stream replace-attoparsecThe pattern matching parser sepreplace-attoparsecparser replace-attoparsecThe pattern matching parser sepreplace-attoparsecparserreplace-attoparsecThe pattern matching parser sepreplace-attoparsecparserreplace-attoparsecThe pattern matching parser sepreplace-attoparsecparser  2019 James BrockBSD2"James Brock None Lreplace-attoparsec Stream editorAlso known as @find-and-replace@, or @match-and-substitute@. Finds all of the sections of the stream which match the pattern sep,, and replaces them with the result of the editor function.*Access the matched section of text in the editor0If you want access to the matched string in the editor, function, then combine the pattern parser sep with  0. This will effectively change the type of the editor function to (Text,a) -> Text.This allows us to write an editor function which can choose to not edit the match and just leave it as it is. If the editor5 function returns the first item in the tuple, then  streamEdit% will not change the matched string. So, for all sep:  streamEdit (  sep)   D  LazinessThis is lazy in the input text chunks and should release processed chunks to the garbage collector promptly.The output is constructed by a . and is subject to the chunk size used there.replace-attoparsec Stream editorMonad transformer version of .The editor3 function will run in the underlying monad context.If you want to do  operations in the editor function then run this in .If you want the editor function to remember some state, then run this in a stateful monad.LazinessThis is lazy in the input text chunks and should release processed chunks to the garbage collector promptly, i.e. as soon as the presence of a sep has been ruled out.Note that this is as only as lazy in the chunks as the selected monad allows it to be, i.e. if your monad requires running the entire computation before getting the result then this is effectively strict in the input stream.The output is constructed by a . and is subject to the chunk size used there.replace-attoparsec Specialized http://hackage.haskell.org/package/parser-combinators/docs/Control-Monad-Combinators.html#v:manyTill_ manyTill_9Parser combinator to consume and capture input until the sep" pattern matches, equivalent to   sep. On success, returns the prefix before the pattern match and the parsed match.sep may be a zero-width parser, it may succeed without consuming any input.7This combinator will produce a parser which acts like  but is predicated beyond more than just the next one token. It is also like + in that it is a @high performance@ parser.Laziness When the  parser reaches the end of the current input chunk before finding the beginning of sep then the parser will fail. When the  parser reaches the end of the current input chunk while it is successfully parsing sep< then it will lazily fetch more input and continue parsing.replace-attoparsecThe pattern matching parser sepreplace-attoparsecThe editor$ function. Takes a parsed result of sep7 and returns a new stream section for the replacement.replace-attoparsec%The input stream of text to be editedreplace-attoparsecThe edited input streamreplace-attoparsecThe pattern matching parser sepreplace-attoparsecThe editor$ function. Takes a parsed result of sep7 and returns a new stream section for the replacement.replace-attoparsec%The input stream of text to be editedreplace-attoparsecThe edited input streamreplace-attoparsecThe pattern matching parser sepreplace-attoparsecparser !"#$#%&'()*+,-./01replace-attoparsec-1.4.5.0-IaztgcPx6H8KGb2lXr7NzZReplace.Attoparsec.ByteStringReplace.Attoparsec.TextReplace.Attoparsec.Text.Lazy Data.List takeWhile Data.TextbreakOnData.Attoparsec.ByteStringmatch Data.Monoidmconcat Data.Tuplefst Data.FunctionidControl.Monad.Combinators manyTill_anyWord8takeTillData.Attoparsec.TextanyCharbreakCapsplitCap streamEdit streamEditTanyTillsepCap findAllCapfindAllbase GHC.MaybeJustGHC.Base<> Data.EitherRightLeftData.Bifunctorsecond Data.Functor<$>ghc-prim GHC.TypesIO text-1.2.3.2Data.Text.Internal.BuilderBuilder