h$$$Q     2019 James BrockBSD2"James Brock  Safe-Inferred*replace-megaparsecThe pattern matching parser sepreplace-megaparsecThe pattern matching parser sep2019 James BrockBSD2"James Brock None replace-megaparsecThe pattern matching parser sepreplace-megaparsecThe pattern matching parser sep2019 James BrockBSD2"James Brock None ?$9 replace-megaparsec 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-megaparsec Break on and capture one patternMonad transformer version of . The parser sep* will run in the underlying monad context.replace-megaparsec!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-megaparsec!Split on and capture all patternsMonad transformer version of . The parser sep* will run in the underlying monad context.replace-megaparsec Stream editorAlso 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 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-megaparsec Stream editorMonad transformer version of .Both the parser sep and the editor4 function will 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 http://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   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.   is also like  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 captureParser 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  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-megaparsec6Find 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-megaparsecFind 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-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-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 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 stream 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 stream replace-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    !"#!$%!&'!&(!)*!+,-./01231replace-megaparsec-1.4.5.0-1UYzTloQ1h5DdrOJCD5rwY&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 anyTillTextbreakCap breakCapTsplitCap splitCapT streamEdit streamEditTanyTillsepCap findAllCapfindAll'megaparsec-9.2.0-1zkfxqueCg0472q1BOULFeText.Megaparsecmatchbase GHC.MaybeJustGHC.Base<> Data.EitherRightLeftData.Bifunctorsecond Data.Functor<$>ghc-prim GHC.TypesIO anySingleText.Megaparsec.Class takeWhileP