O      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMN RFelipe Lessa 2010, Bryan O'Sullivan 2008, Mario Bla~evi <blamario@yahoo.com> 2014BSD3Mario Bla~evi experimentalunknownNoneO Create a set.PCheck the set for membership.QROSTPUQOSPUQROSTPU?Bryan O'Sullivan 2011, Mario Bla~evi <blamario@yahoo.com> 2014BSD3blamario@yahoo.com experimentalunknown Safe-Inferred;A simple parser.CThis monad is strict in its state, and the monadic bind operator (VJ) evaluates each result to weak head normal form before passing it along. Run a parser.*Consume input while the predicate returns W.*Consume input while the predicate returns W.Consume n prime tokens of input.Match a string exactly.7Indicate whether the end of the input has been reached.XYZ[\]^_`abcXYZ\[]^_`abcDBryan O'Sullivan 2007-2011, Mario Bla~evi <blamario@yahoo.com> 2014BSD3Mario Bla~evi experimentalunknownSafeHMd!Have we read all available input?;The core parser type. This is parameterised over the type t of string being processed.2This type is an instance of the following classes:e, where f; throws an exception (i.e. fails) with an error message.g and h%, which follow the usual definitions.i, where j& fails (with no error message) and k executes the right-hand parser if the left-hand one fails. When the parser on the right executes, the input is reset to the same state as the parser on the left started with. (In other words, Picoparsec is a backtracking parser that supports arbitrary lookahead.)l, which follows i.<The result of a parse. This is parameterised over the type t of string that was processed.This type is an instance of g, where m transforms the value in a   result. The parse succeeded. The t[ parameter is the input that had not yet been consumed (if any) when the parse succeeded. Supply this continuation with more input so that the parser can resume. To indicate that no more input is available, use an empty string. The parse failed. The tY parameter is the input that had not yet been consumed when the failure occurred. The [n]; is a list of contexts in which the error occurred. The n. is the message describing the error, if any.&dopqrstuvwxyz {|}~dopqrstuvwxyz |dpoqrstuvwxyz {|}~?Bryan O'Sullivan 2011, Mario Bla~evi <blamario@yahoo.com> 2014BSD3Mario Bla~evi experimentalunknown Safe-Inferred  ?Bryan O'Sullivan 2012, Mario Bla~evi <blamario@yahoo.com> 2014BSD3Mario Bla~evi experimentalunknown Safe-Inferred  Compare two  values for equality.If both s are  , the result will be ^, as they are incomplete and hence their equality cannot be known. (This is why there is no  instance for .)kAsk for input. If we receive any, pass it to a success continuation, otherwise to a failure continuation.$Immediately demand more input via a   continuation result.)This parser always succeeds. It returns WA if any input is available either immediately or on demand, and + if the end of all input has been reached.   [Daan Leijen 1999-2001, Bryan O'Sullivan 2009-2010, Mario Bla~evi <blamario@yahoo.com> 2014BSD3Mario Bla~evi experimentalportable Safe-Inferred cAttempt a parse, and if it fails, rewind the input so that no input appears to have been consumed.kThis combinator is provided for compatibility with Parsec. Picoparsec parsers always backtrack on failure.(Name the parser, in case failure occurs. choice ps( tries to apply the actions in the list psT in order, until one of them succeeds. Returns the value of the succeeding action. option x p tries to apply action p. If p6 fails without consuming input, it returns the value x#, otherwise the value returned by p. +priority = option 0 (digitToInt <$> digit) A version of liftM23 that is strict in the result of its first action.many' p applies the action p zero: or more times. Returns a list of the returned values of p. The value returned by p is forced to WHNF.  word = many' lettermany1 p applies the action p one: or more times. Returns a list of the returned values of p.  word = many1 lettermany1' p applies the action p one: or more times. Returns a list of the returned values of p. The value returned by p is forced to WHNF.  word = many1' letter sepBy p sep applies zero or more occurrences of p, separated by sep+. Returns a list of the values returned by p. $commaSep p = p `sepBy` (symbol ",") sepBy' p sep applies zero or more occurrences of p, separated by sep+. Returns a list of the values returned by p. The value returned by p is forced to WHNF. %commaSep p = p `sepBy'` (symbol ",") sepBy1 p sep applies one or more occurrences of p, separated by sep+. Returns a list of the values returned by p. %commaSep p = p `sepBy1` (symbol ",") sepBy1' p sep applies one or more occurrences of p, separated by sep+. Returns a list of the values returned by p. The value returned by p is forced to WHNF. &commaSep p = p `sepBy1'` (symbol ",")manyTill p end applies action p zero or more times until action end7 succeeds, and returns the list of values returned by p%. This can be used to scan comments: C simpleComment = string "<!--" *> manyTill anyChar (string "-->")(Note the overlapping parsers anyChar and  string "-->"\. While this will work, it is not very efficient, as it will cause a lot of backtracking.)manyTill' p end applies action p zero or more times until action end7 succeeds, and returns the list of values returned by p%. This can be used to scan comments: D simpleComment = string "<!--" *> manyTill' anyChar (string "-->")(Note the overlapping parsers anyChar and  string "-->"\. While this will work, it is not very efficient, as it will cause a lot of backtracking.)The value returned by p is forced to WHNF.)Skip zero or more instances of an action.(Skip one or more instances of an action.:Apply the given action repeatedly, returning every result.Combine two alternatives.*Match only if all input has been consumed.CReturn an indication of whether the end of input has been reached.  the name to use if parsing fails    DBryan O'Sullivan 2007-2011, Mario Bla~evi <blamario@yahoo.com> 2014BSD3Mario Bla~evi experimentalunknown Safe-InferredHM#WIf at least one token of input is available, return the current input, otherwise fail.kAsk for input. If we receive any, pass it to a success continuation, otherwise to a failure continuation.$Immediately demand more input via a   continuation result.)This parser always succeeds. It returns WA if any input is available either immediately or on demand, and + if the end of all input has been reached.)This parser always succeeds. It returns W+ if any input is available on demand, and * if the end of all input has been reached.! The parser  satisfy p= succeeds for any prime input token for which the predicate p returns W-. Returns the token that is actually parsed. Bdigit = satisfy isDigit where isDigit w = w >= "0" && w <= "9"" The parser  satisfy p; succeeds for any input character for which the predicate p returns W2. Returns the character that is actually parsed. Bdigit = satisfy isDigit where isDigit w = w >= "0" && w <= "9"# The parser skip p= succeeds for any prime input token for which the predicate p returns W. CskipDigit = skip isDigit where isDigit w = w >= "0" && w <= "9"$ The parser satisfyWith f p; transforms an input token, and succeeds if the predicate p returns WU on the transformed value. The parser returns the transformed token that was parsed.Consume n= tokens of input, but succeed only if the predicate returns W.%Consume exactly n prime input tokens.&string s4 parses a prefix of input that identically matches s". Returns the parsed string (i.e. sI). This parser consumes no input if it fails (even if a partial match).Note: The behaviour of this parser is different to that of the similarly-named parser in Parsec, as this one is all-or-nothing. To illustrate the difference, the following parser will fail under Parsec given an input of "for": string "foo" <|> string "for"fThe reason for its failure is that the first branch is a partial match, and will consume the letters 'f' and 'o'8 before failing. In Attoparsec, the above parser will succeedF on that input, because the failed first branch will consume nothing.'5Skip past input for as long as the predicate returns W.(@Skip past input characters for as long as the predicate returns W.)/Consume input as long as the predicate returns  (i.e. until it returns W!), and return the consumed input.UThis parser does not fail. It will return an empty string if the predicate returns W on the first input token.NoteM: Because this parser does not fail, do not use it with combinators such as manyh, because such parsers loop until a failure occurs. Careless use will thus result in an infinite loop.*:Consume input characters as long as the predicate returns  (i.e. until it returns W!), and return the consumed input.UThis parser does not fail. It will return an empty string if the predicate returns W on the first input token.NoteM: Because this parser does not fail, do not use it with combinators such as manyh, because such parsers loop until a failure occurs. Careless use will thus result in an infinite loop.+HConsume all input until the character for which the predicate returns W and return the consumed input.The only difference between * and +d is in their handling of non-character data: The former never consumes it, the latter always does.UThis parser does not fail. It will return an empty string if the predicate returns W on the first input token.NoteM: Because this parser does not fail, do not use it with combinators such as manyh, because such parsers loop until a failure occurs. Careless use will thus result in an infinite loop.,HConsume all input until the character for which the predicate returns W and return the consumed input.This parser always consumes at least one token: it will fail if the input starts with a character for which the predicate returns W or if there is no input left.-/Consume input as long as the predicate returns W!, and return the consumed input.UThis parser does not fail. It will return an empty string if the predicate returns  on the first input token.NoteM: Because this parser does not fail, do not use it with combinators such as manyh, because such parsers loop until a failure occurs. Careless use will thus result in an infinite loop..:Consume input characters as long as the predicate returns W", and return the consumed input.UThis parser does not fail. It will return an empty string if the predicate returns  on the first input token.NoteM: Because this parser does not fail, do not use it with combinators such as manyh, because such parsers loop until a failure occurs. Careless use will thus result in an infinite loop./=Consume all remaining input and return it as a single string.0/Consume input as long as the predicate returns W!, and return the consumed input.xThis parser requires the predicate to succeed on at least one input token: it will fail if the predicate never returns W or if there is no input left.2A stateful scanner. The predicate consumes and transforms a state argument, and each transformed state is passed to successive invocations of the predicate on each token of the input until one returns  or the input ends.UThis parser does not fail. It will return an empty string if the predicate returns ! on the first prime input factor.NoteM: Because this parser does not fail, do not use it with combinators such as manyh, because such parsers loop until a failure occurs. Careless use will thus result in an infinite loop.3A stateful scanner. The predicate consumes and transforms a state argument, and each transformed state is passed to successive invocations of the predicate on each token of the input until one returns  or the input ends.UThis parser does not fail. It will return an empty string if the predicate returns ! on the first prime input factor.NoteM: Because this parser does not fail, do not use it with combinators such as manyh, because such parsers loop until a failure occurs. Careless use will thus result in an infinite loop.4Match any prime input token.5%Match any prime input token. Returns ? if end of input has been reached. Does not consume any input.NoteM: Because this parser does not fail, do not use it with combinators such as manyh, because such parsers loop until a failure occurs. Careless use will thus result in an infinite loop.6Match any character.7Match a specific character.8DMatch any input character, if available. Does not consume any input.NoteM: Because this parser does not fail, do not use it with combinators such as manyh, because such parsers loop until a failure occurs. Careless use will thus result in an infinite loop.9dMatch any input character, failing if the input doesn't start with any. Does not consume any input.:(Match either a single newline character '\n'8, or a carriage return followed by a newline character "\r\n".Terminal failure continuation.Terminal success continuation.; Run a parser.<-Run a parser that cannot be resupplied via a   result.+ !"#$%&'()*+,-./0123456789:;<4  !"#$%&'()*+,-./0123456789:;<+ !"#$%&'()*+,-./0123456789:;</Bryan O'Sullivan 2007-2011, Mario Bla~evi 2014BSD3Mario Bla~evi experimentalunknown Safe-Inferred=If a parser has returned a  $ result, supply it with more input.>5Run a parser and print its result to standard output.?fRun a parser with an initial input string, and a monadic action that can supply more input if needed.@ Convert a   value to a  value. A   result is treated as failure.A Convert a   value to an  value. A   result is treated as failure.=>?rAn action that will be executed to provide the parser with more input, if necessary. The action must return an mempty. string when there is no more input available.Initial input for the parser.@A;  !"#$%&'()*+,-./0123456789:;<=>?@A(  ;=<?>@A45!$#6789"2&'%-0)3(.1*+,/:=>?@A?Bryan O'Sullivan 2011, Mario Bla~evi <blamario@yahoo.com> 2014BSD3Mario Bla~evi experimentalunknownNone+BiA numeric type that can represent integers accurately, and floating point numbers to the precision of a .EBParse and decode an unsigned hexadecimal number. The hex digits 'a' through 'f' may be upper or lower case.&This parser does not accept a leading "0x" string.F,Parse and decode an unsigned decimal number.G(Parse a number with an optional leading '+' or '-' sign character.HParse a rational number.This parser accepts an optional leading sign character, followed by at least one decimal digit. The syntax similar to that accepted by the . function, with the exception that a trailing '.' or 'e' not& followed by a number is not consumed.%Examples with behaviour identical to 9, if you feed an empty continuation to the first result: rational "3" == Done 3.0 "" rational "3.1" == Done 3.1 "" rational "3e4" == Done 30000.0 "" rational "3.1e4" == Done 31000.0, ""%Examples with behaviour identical to : yrational ".3" == Fail "input does not start with a digit" rational "e3" == Fail "input does not start with a digit"Examples of differences from : Drational "3.foo" == Done 3.0 ".foo" rational "3e" == Done 3.0 "e"MThis function does not accept string representations of "NaN" or "Infinity".IParse a rational number.6The syntax accepted by this parser is the same as for H.Note0: This function is almost ten times faster than H!, but is slightly less accurate.The ] type supports about 16 decimal places of accuracy. For 94.2% of numbers, this function and H give identical results, but for the remaining 5.8%, this function loses precision around the 15th decimal place. For 0.001% of numbers, this function will lose precision at the 13th or 14th decimal place.MThis function does not accept string representations of "NaN" or "Infinity".J@Parse a number, attempting to preserve both speed and precision.6The syntax accepted by this parser is the same as for H.Note0: This function is almost ten times faster than H~. On integral inputs, it gives perfectly accurate answers, and on floating point inputs, it is slightly less accurate than H.CThis function does not accept string representations of "NaN" or "KParse a scientific number.6The syntax accepted by this parser is the same as for H.BCDEFGHIJK BCDEFGHIJK BDCFEGIJHKBDCEFGHIJK(Mario Bla~evi <blamario@yahoo.com> 2015BSD3Mario Bla~evi experimentalunknown Safe-InferredLReturns the current user state.MSets the current state.NModifies the current state.LMNLMNLMNLMN      !"#$%&'( ) * + , -   . / 0 1 2 3  4 5 6 7 8 9 : ; < = > ? @ABCDEFGHIJKLMNOPQRSTUUVWXYZ[\]^ _)`abcdefghYZiYZjYZkYlmYnoYnpYnqYlrYZsYZtuvwx _yz{|H}~cdgefY\ \] b Y b YY\]Ypicoparsec-0.1Data.Picoparsec.ZeptoData.Picoparsec.TypesData.PicoparsecData.Picoparsec.CombinatorData.Picoparsec.NumberData.Picoparsec.StateData.Picoparsec.Text.FastSetData.Picoparsec.Internal.TypesData.Picoparsec.InternalData.Picoparsec.Monoid.InternalParserparse takeWhiletakeCharsWhiletakestringatEndIResultDonePartialFailcompareResultstrychoiceoptionmany'many1many1'sepBysepBy'sepBy1sepBy1'manyTill manyTill'skipMany skipMany1counteitherP endOfInputResultsatisfy satisfyCharskip satisfyWith skipWhileskipCharsWhiletakeTill takeCharsTill takeTillChar takeTillChar1takeRest takeWhile1takeCharsWhile1scan scanCharsanyToken peekTokenanyCharcharpeekChar peekChar' endOfLine parseOnlyfeed parseTest parseWith maybeResult eitherResultNumberDI hexadecimaldecimalsignedrationaldoublenumber scientificgetStateputState modifyStatesetmemberFastSetfromListmkSet charClassbaseGHC.Base>>=ghc-prim GHC.TypesTrue runParserOKgetsput$fAlternativeParser$fApplicativeParser$fMonadPlusParser $fMonadParser$fFunctorParserMoreMonadfailFunctorControl.Applicative Applicative Control.Monad MonadPlusmzeromplus AlternativefmapString IncompleteCompleteSuccessFailureAddedAunAInputunIfmapRaddSbindPreturnPnoAddsplusfmapPapPfailDesc $fMonoidMore $fMonoidAdded $fMonoidInput$fFunctorIResult$fNFDataIResult $fShowIResult Data.MaybeNothing GHC.ClassesEqprompt demandInput wantInputFalsegetliftM2' ensureOne wantMoreInputtakeWith Data.MonoidmemptyfailKsuccessKensure' takeWith'string'stringTransformMaybe Data.EitherEitherDouble Text.Readreadbinopscientifically$fRealFracNumber$fFractionalNumber $fRealNumber $fNumNumber $fOrdNumber $fEqNumber$fNFDataNumber $fShowNumber