úÎ!x}wA    ©2019 James BrockBSD2"James Brock <jamesbrock@gmail.com>NoneHSVX£replace-megaparsecThe pattern matching parser sepreplace-megaparsecThe pattern matching parser sep©2019 James BrockBSD2"James Brock <jamesbrock@gmail.com>NoneHSVX®replace-megaparsecThe pattern matching parser sepreplace-megaparsecThe pattern matching parser sep©2019 James BrockBSD2"James Brock <jamesbrock@gmail.com>None >HPSVX_kvýreplace-megaparsec Break on and capture one pattern‰Find 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 R, 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 sepW 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 textLIf you want to capture the matched string, then combine the pattern parser sep with  .GWith 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-megaparsec!Split on and capture all patterns#Find all occurences of the pattern sepC, 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 textMIf you want to capture the matched strings, then combine the pattern parser sep with  .HWith the matched strings, we can reconstruct the input string. For all input, sep, if let output = splitCap (  sep) input then  input ==   (    output) replace-megaparsec Stream editor‡Also known as find-and-replace , or match-and-substitute . Finds all non-overlapping 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  (s,a) -> s.This allows us to write an editorU 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)   "a   replace-megaparsecStream editor transformerMonad transformer version of .Both the parser sep and the editor/ function run in the underlying monad context.If you want to do  operations in the editor function or the parser sep, then run this in .If you want the editor function or the parser sep< to remember some state, then run this in a stateful monad.replace-megaparsec Specialized ehttp://hackage.haskell.org/package/parser-combinators/docs/Control-Monad-Combinators.html#v:manyTill_ manyTill_-Parser combinator to consume input until the sep" pattern matches, equivalent to   sepP. On success, returns the prefix before the pattern match and the parsed match.sepI 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.  is also like A in that it will be fast  when applied to an input stream type s4 for which there are specialization re-write rules. replace-megaparsecSeparate and captureaParser combinator to find all of the leftmost non-overlapping occurrences of the pattern parser 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 parser combinators found in  Yhttp://hackage.haskell.org/package/parser-combinators/docs/Control-Monad-Combinators.htmlparser-combinators and  Lhttp://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.OutputAThe 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 [].fIf 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-megaparsec6Find all occurences, parse and capture pattern matchesFParser 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-megaparsecFind all occurencesFParser combinator for finding all occurences of a pattern in a stream. Will call   with the  B combinator and return the text which matched the pattern parser sep in the  sections. Definition: findAll sep = (fmap.fmap) ( fst) $   (  sep) replace-megaparsecThe pattern matching parser sepreplace-megaparsecThe input stream of textreplace-megaparsec$Maybe (prefix, parse_result, suffix)replace-megaparsecThe pattern matching parser sepreplace-megaparsecThe input stream of textreplace-megaparsec1List of matching and non-matching input sections.replace-megaparsecThe pattern matching parser sepreplace-megaparsecThe editor$ function. Takes a parsed result of sep7 and returns a new stream section for the replacement.replace-megaparsec%The input stream of text to be editedreplace-megaparsecThe edited input streamreplace-megaparsecThe pattern matching parser sepreplace-megaparsecThe editor$ function. Takes a parsed result of sep7 and returns a new stream section for the replacement.replace-megaparsec%The input stream of text to be editedreplace-megaparsecThe edited input streamreplace-megaparsecThe pattern matching parser sepreplace-megaparsecparser replace-megaparsecThe pattern matching parser sepreplace-megaparsecparser replace-megaparsecThe pattern matching parser sepreplace-megaparsecparser replace-megaparsecThe pattern matching parser sepreplace-megaparsecparser   !"#$%$&'()*+,-./011replace-megaparsec-1.4.3.0-5ocviLQ1KUK13BQ9HgQWUG&Replace.Megaparsec.Internal.ByteString Replace.Megaparsec.Internal.TextReplace.Megaparsec Data.List takeWhile Data.TextbreakOn Data.Monoidmconcat Data.Tuplefst Data.FunctionidControl.Monad.Combinators manyTill_sepCapByteStringanyTillByteString sepCapText anyTillTextbreakCapsplitCap streamEdit streamEditTanyTillsepCap findAllCapfindAll'megaparsec-9.0.0-CRKRRSoqPia7uOlYeDVII9Text.Megaparsecmatchbase GHC.MaybeJustGHC.Base<> Data.EitherRightLeftData.Bifunctorsecond Data.Functor<$>ghc-prim GHC.TypesIO anySingleText.Megaparsec.Class takeWhileP