HOOG $1 ""..XX<>?a%"%%((2269;;=AEEIIKPTTVZ]eggmmqrttvb -.LMllrrwwc (44AAFGYY^^ffmnz|d##&&(*,.77??AEOOTTacffllnne !&((+57GJOQV[accflpswf ,,//67??CCHHOOaacceeklpp~~g))227=BBJJNO[`ggnnh  >BTTi$$()11::<<AJSSZZ`ciinnuw~~jKKk 1199>@TTVVhhool $$((67>ADDFGIIKUZZ\\deiilmrsvv~~m&((+,22AAFFRRVcfgww{{~~n  #'-.117:<<CJNOSSVZ``blppuxo! '**/36699<<FGIITV[\^^acehjw}~p!"+,358<IIVV\\^^jjqq__r$ %%035589;;CGJJQQUV[\^^``beghqtxs !"%&1389;@EGIIKKMMVV]afgjjttxt% #%''),44669=@@BEIKQQVVZZ`adflnqw||u&'1177::FGNOYYdehhvKKw11UUgjllx 45ABHHRRy +.@@KKPPWZ\\aallwwzPP| hz*v%k()_%->.%All %Any$ BlockReason$Bool$ ByteStringn$CChar&$CClock#CDev#CDoublei#CFloat#CIno"CInt"CIntMax8"CIntPtr!CLDouble!CLLongO!CLong!CMode COffw CPid/ CPtrdiffCSCharCShortW CSigAtomicCSizeCSsizeCTimeMCUCharCUIntCUIntMaxuCUIntPtr-CULLongCULongCUShortUCWchar ChanCharComplex ConsoleEventConstr ConstrRepConsumedDataRepDataTypeDoubleqDynamicXE12IE6:Either/Errno+ ExceptionFdFixityFloatGeneralCategoryHashDatazIOGIOError5Id IdentityInsertsIntInt16Int32Int64Int8IntPtr7IntegerLexemeListT MaybeMessageNestedAtomically NoMethodError|NonTerminationcOrderingSPB ParseError<PatternMatchFail#QSemQSemNReadPReadPrec RecConError RecSelError RecUpdErrorSTMy SourcePosl StableNameaStringZTVarOThreadId9 ThreadStatus,TimeoutUniqueVersionWordWord16Word32Word64Word8pWordPtr(ZipList[::][] TraversableFoldable Applicative AlternativeMonadFix MonadPlusFunctorMonadFunctor Applicative ReadShowTypeableBitsIntegralBoundedRealStorableEnumNumOrdEq PrintfArgDataStorable PrintfArgDataStorable PrintfArgDataStorable PrintfArgDataStorable PrintfArgDataStorableEqOrdShowReadTypeableOrdEqTypeableShow ExceptionEqShowOrdEqShowEqOrdTypeable Typeable1Error Typeable1ShowOrdEq Typeable1FunctorMonadTypeableShow ExceptionTypeableShow ExceptionTypeableShow ExceptionFunctorMonad MonadPlusFunctorMonad MonadPlusTypeableTypeableTypeableShow ExceptionShowMonad MonadPlusMonoidDataIxTypeableShow ExceptionTypeableShow ExceptionTypeableShow ExceptionEnumEqOrd TraversableFoldable Applicative AlternativeMonadFix MonadPlusFunctorMonad MonadTransShowEq PrintfArgDataBitsIx ReadShowTypeableBitsIntegralBoundedRealStorableEnumNumOrdEq PrintfArgDataStorable PrintfArgDataStorable PrintfArgDataStorable PrintfArgDataStorable PrintfArgDataStorableBitsIxEqFunctorMonadMonadFixFunctor Applicative MonadErrorError ApplicativeMonadFix MonadPlus MonadErrorMonadIOShowEqIxBoundedShowReadEnumOrdEq PrintfArgDataStorableShowEq ReadShowTypeableBitsIntegralBoundedRealStorableEnumNumOrdEqTypeable ExceptionShowEqEq Typeable2 HasResolution HasResolution ExceptionTypeableShow PrintfArgDataStorableShowShowEqFunctorShowEqShowEqReadShowEnumOrdEqTypeable Typeable1 PrintfArgIsCharDataStorableIx Typeable1 ReadShowTypeableBitsIntegralBoundedRealStorableEnumNumOrdEq ReadShowTypeableBitsIntegralBoundedRealStorableEnumNumOrdEq ReadShowTypeableBitsIntegralBoundedRealStorableEnumNumOrdEq ReadShowTypeableBitsIntegralBoundedRealStorableEnumNumOrdEq ReadShowTypeableBitsIntegralBoundedRealStorableEnumNumOrdEq ReadShowTypeableBitsIntegralBoundedRealStorableEnumNumOrdEq ReadShowTypeableBitsIntegralBoundedRealStorableEnumNumOrdEq ReadShowTypeableBitsIntegralBoundedRealStorableEnumNumOrdEq ReadShowTypeableRealStorableEnumNumOrdEq ReadShowTypeableBitsIntegralBoundedRealStorableEnumNumOrdEq ReadShowTypeableBitsIntegralBoundedRealStorableEnumNumOrdEq ReadShowTypeableBitsIntegralBoundedRealStorableEnumNumOrdEq ReadShowTypeableBitsIntegralBoundedRealStorableEnumNumOrdEq ReadShowTypeableBitsIntegralBoundedRealStorableEnumNumOrdEq ReadShowTypeableBitsIntegralBoundedRealStorableEnumNumOrdEq ReadShowTypeableBitsIntegralBoundedRealStorableEnumNumOrdEq ReadShowTypeableBitsIntegralBoundedRealStorableEnumNumOrdEq ReadShowTypeableBitsIntegralBoundedRealStorableEnumNumOrdEq ReadShowTypeableBitsIntegralBoundedRealStorableEnumNumOrdEq ReadShowTypeableBitsIntegralBoundedRealStorableEnumNumOrdEq ReadShowTypeable RealFloatRealFracFloating FractionalRealStorableEnumNumOrdEq ReadShowTypeableBitsIntegralBoundedRealStorableEnumNumOrdEq ReadShowTypeableBitsIntegralBoundedRealStorableEnumNumOrdEq ReadShowTypeableBitsIntegralBoundedRealStorableEnumNumOrdEq ReadShowTypeableBitsIntegralBoundedRealStorableEnumNumOrdEq ReadShowTypeable RealFloatRealFracFloating FractionalRealStorableEnumNumOrdEq ReadShowTypeable RealFloatRealFracFloating FractionalRealStorableEnumNumOrdEq ReadShowTypeableRealStorableEnumNumOrdEq ReadShowTypeableRealStorableEnumNumOrdEq ReadShowTypeableBitsIntegralBoundedRealStorableEnumNumOrdEqIsStringEqOrdMonoidIsStringEqOrdMonoidDataReadShowTypeableShowReadDataTypeableDataStorableIxShowOrdEqMonoidBoundedShowReadOrdEqMonoidBoundedShowReadOrdEqArrow ArrowChoice ArrowApply ArrowLoopCategoryMonoidDataEqOrdIxz%' ByteCount*CString* CStringLen*CWString* CWStringLenl* CharParserC* ClockTick:*Column4*ConIndex.*DeviceID'* EpochTime*FileID*FileMode* FileOffset *FilePath)FinalizerEnvPtr) FinalizerPtr) GenParserz)IOErrorl)IPrZ) LanguageDef*)Limit")Line)Micro) OperatorTable(Parsec(Parser( PermParseri(PicoZ(PrecT(ProcessGroupIDM( ProcessIDF(Rational3(ReadS( SampleVar'ShowS' SourceName'String' TokenParser'stGenTokenParser[]CharstIdentity[]Char[]Char[]Char[]CharaMVar(,)IntMVaraa[]Char[](,)a[]CharRatioIntegerCPidCPidIntFixedE12tokstaStreamPermParser[]CharstaParsecT[]Char()IdentitysuParsecTsuIdentitytoksta[][]OperatortokstaFixedE6IntCLongstGenLanguageDef[]CharstIdentity(,)IntInt IOExceptiontokstParsecT[]tokstIdentityaFunPtrPtraIO()envaFunPtrPtrenvPtraIO()[]CharCOffCModeCInoCTimeCDevIntIntCClockstParsecT[]CharstIdentity(,)PtrCWcharIntPtrCWchar(,)PtrCCharIntPtrCCharCSize(Uz[!zatbocedae]fYgoXhViBRj"RkQlNm&JnRGo"Dp?q?r:sm4t0u+.v-w+z^+|S+|ie+pl+ls+iz+s+t+ZipList#-e-o-r+a,i+t+e+m+r+Writert+WriterTo,d ,e,IOModep#,a,m,p4,e;,dB,a,mN,oU,n\,ac,dj, WrappedMonadr,r,o,w, WrappedArrowo,n,a,d, WrappedMonadr,r,o,w, WrappedArrowr-d-Word#-1-3-6v-8g-pH-tO-rV-WordPtrWord84}-Word642-Word326-Word16Word#a-k-WeakWorde-r-s.i .o.n.Versionn /p.s<.eC.rJ.iQ.nX.t_.ef.rm.rt.u{.p.t.AsyncExceptionp.e.r.c.a.s.e.l.e.t.t.e.r.GeneralCategoryds/eC/i/q%/u,/e3/UniquexJ/pQ/eX/c_/tf/Messageez/f/r/f/l/o/w/ArithExceptioni/n/e/d/e/l/e/m/e/n/t0ArrayExceptionh2i92o1r1va1y70cD1pC0eJ0au0rV0e]0pd0TypeRepb|0l0e0Typeable111213 140506070 Typeable7 Typeable6 Typeable5 Typeable4 Typeable3 Typeable2 Typeable1oK1nR1TyConah1ro1TVar#1TVar#a1v1e1r1s1a1b1l1e1 Traversablek1e1n1p2a2r2s2e2r$2 TokenParsert@2lG2eN2cU2a\2sc2ej2lq2ex2t2t2e2r2GeneralCategoryr2e2a2d2b14d 4f3i3k_3r#3s2t2a2t2u3s 3 ThreadStatusu*3n13n83i?3nF3gM3 ThreadStatusif3lm3lt3e{3d3AsyncExceptiond3ThreadId#3 ThreadId#i3n3i3s3h3e3d3 ThreadStatusi4e4d4 ThreadStatusl84o?4cF4kM4eT4d[4 ThreadStatusa:e:h9o8p8ta5u 5y4m4s4u4n4e4x4p4e4c4t4Messageb4o4l4LexememT5r5r5o#5g*5a15t85e?5GeneralCategorySumSTa6m6o6r5e6i5n5g5Stringc5r5e5p5DataRepo5n5s5t5r5 ConstrRepa16f"6p6STRepSTRefm86StreampM6eT6r[6mb6pi6ap6rw6s~6e6r6StreamPermParserr6a6b6l6e6StorableSTMb7cd7r>7t6e7State#.7t7StateTState#rE7aL7yS7STArraykk7or7vy7e7r7f7l7o7w7AsyncExceptionl7e7n7p7t7r7 StablePtra7m8e8 StableNamea"8c)8e8i58n<8gC8cJ8oQ8mX8b_8if8nm8it8n{8g8m8a8r8k8GeneralCategoryGeneralCategorym?9u8r8c8e8n9p8o8s9 SourcePosa9m$9e+9 SourceNameeF9eM9xT9c[9eb9pi9tp9iw9o~9n9 SomeExceptiono9u9t9d9o9w9n9 ConsoleEventw9Shows9ShowSe :k:fG:m :o':d.:e5:SeekModerN:oU:m\:ec:nj:dq:SeekModem:p:l:e:v:a:r: SampleVara>e!;i;w:s:RWSt:RWSTg;h;t;EitheraP=cm<l <p<q;tA;uH;rO;nV;i];nd;ok;rr;dy;e;r;ArgOrdera;u;i;r;e;o;r;d;e;r;ArgOrderr;g;ArgDescrl <y<Replya'<t.<i5<v<<eC<sJ<eQ<eX<k_<SeekModec =s<u~<p<d<e<r<r<o<r< RecUpdErrore<l<e<r<r<o<r< RecSelErroro=n=e=r&=r-=o4=r;= RecConErrord=l\=Realf=wt=o{=r=l=d= RealWorldl=r=a=c=RealFraco=a=t= RealFloatReade>m>pq>sb>w>r%>i,>t3>e:>mA>oH>dO>eV>IOModeReadSReadPr>e>c>ReadPreco>d>e>IOModer>Readert>ReaderTtb?u ?f?f?e"?r)? RawBufferLexemeiM?oT?Rationh?ao?lv?Rationals?e?m?QSemn?QSemNaBe3BiBoAr'@s@t@u?n?c?Lexemer @Ptr ByteStringeAi@o8@cj@dD@uK@cR@tY@Producteq@sx@s@g@i@d@ ProcessIDr@o@u@p@i@d@ProcessGroupIDn2Av@a@tAeAuAsAeAGeneralCategoryt9Af@AauAtLAySApZAeaA PrintfTyper|AgA PrintfArgcAfAiAxAOperatorPrecoBsAtAfAiAxAOperatorl BPoolcBo%BPicor:BmABpiBuMBtTBe[BArgOrderapBrwBs~BeBrB PermParserr!CtBtBeBrBnBmBaBtBcBhBfBaBiClCPatternMatchFailaCs-Ce4CcCeUCrECParserr\CrcCojCrqC ParseErrorParsectCParsecTgCrCaCpChCsCeCpCaCrCaCtCoDr DGeneralCategorykGGpErEt{Dv=DeDDrKDfRDlYDo`DwgDArithExceptionhDeDrDlqEn9EpDsDyDmDbDoDlDGeneralCategoryuDnDcDtDuEaEtEiEoEn$EGeneralCategoryu@EmGEbNEeUEr\EGeneralCategoryexEtEtEeErEGeneralCategorydEOrdeErEiEnEgEOrderingesFtEaWFd)Fi FoFnFOptDescre0Fs7Fc>FrEFOptDescrr^FgeFArgDescrnFrFaFtFoFrFOperatortFaFbFlFeF OperatorTablepFuFnFcGtGuGaGtGi$Go+Gn2GGeneralCategoryReplyeIowGucGmjGNumaIbFImHn$Hr HtGaGhGiGnGgGMaybesGsGiGgGnGeGdGGeneralCategoryeHpHDataRepsHt0He7Hr>HmEHiLHnSHaZHtaHihHooHnvHNonTerminationpHaHcHiHnHgHmHaHrHkHGeneralCategoryeHtHhHoId IeIrIr!Io(Ir/I NoMethodErroruMIfTIf[IebIriIipInwIg~I BufferModerIgIArgDescrsItIeIdIaItIoImIiIcIaIlIlJy JNestedAtomicallyaONeNiMo9KuvJvFJaMJrTJMVar#gJMVar#t}JaJbJlJeJaJbJyJtJeJaJrJrJaJyJ#JMutableByteArray#rKr KaKyK#"K MutableArray#dXMnEKaoKoQKiXKd_KMonoiddvKMonad c0MeMfLiLpLrJLsLtKwKrKiKtKeKrK MonadWriterrKaKnKsL MonadTranst!La(Lt/Le6L MonadStateeoLwVLs]LMonadRWSavLd}LeLrL MonadReaderlLuLsL MonadPlusoLMonadIOiLxLMonadFixrMrMoMrM MonadErroro7Mn>MtEM MonadConti_MffMimMetMr{MlMsMyMmMbMoMlMGeneralCategoryeMtMtMeMrMGeneralCategorycMrNo NMicros"Ns)Na0Ng7Ne>NMessagetxNy[NbbNeiNMaybehNsNyNmNbNoNlNGeneralCategoryayQePiOoNgOsNOwNeNrNcNaOsOeOlOeOt$Ot+Oe2Or9OGeneralCategorysUOo\OfcOpjOrqOexOcOiOsOiOoOnOArithExceptionoOfOfO ConsoleEventmPn PsOtOtOListTePLinebwPs*Pe1Pp8Pa?PrFPaMPtTPo[PrbPGeneralCategoryu~PfPfPePrPiPnPgP BufferModeiPtPLimitffQtQxPePmPeQLexemetQe Qr'Qn.Qu5QmdDatar}dtVdy]dpddekdDataTypeedpdDataRephdpdudndcdtdudadtdidodndGeneralCategorya8ocndnf,nhmi'mjllkmkoiphsgtfguewReces^eteerleisenzegeCWStringleeene CWStringLenheaereCWcharcAgiflfr(fsehfo frftfCUShortr/fe6fn=fcDfyKfsRfyYfm`fbgfonflufGeneralCategorylfofnfgfCULongofnfgfCULLongnftfCUIntm!gpgtgrgCUIntPtra(gx/gCUIntMaxhHgaOgrVgCUCharimgmtge{gCTimechh~hihsgtgrgigngggCStringlgegng CStringLenihzhehCSsizeg@hz*he1hCSizeaGhtNhoUhm\hichcjh CSigAtomicohrhthCShorthhahrhCSChari ithrhdhihfhfhCPtrdiffdiCPidfyklTkm'kn4iijntjsitJiContrqitbiContToxiliGeneralCategoryci ConsoleEvento-jtiuimieidiConsumedConstriConstrr jejpj ConstrRepl4je;jeBjvIjePjnWjt^j ConsoleEvente{jcjtjojrjpjujnjcjtjujajtjijojnjGeneralCategorynkdkekxkConIndexp.kl5ke=musGenLanguageDefF musGenTokenParser$ a ParseErrorEither#!usStatei()IO"Char[]YMEMessage[]TaConsumedca ParseErrorEitherIO a ParseErrorEitherm1IdentitystChar[]GenLanguageDefIdentitystChar[]GenTokenParserChar[][]st(,)MaybemhausReplymConsumedm.ۑeM ؏Uȍb? b.vQT8_ SourcePosst SourcePostsBoolCharn SourcePostubarqpuuvbmusParsecTa2 SourcePost[] SourcePosma[]a[]aoChar[]tutsaMaybetuts amusParsecTamusParsecT$$$$$$ a[]musParsecTamusParsecT$$$$usStateusStatek ausReplymConsumedmusStatel()musParsecTChar[]$$Char[]musParsecTChar[]$ Char[]t[]m Assoc6BoolF FChar\KInt`_LGGMessageQPOONNM ParseError fbWVVUTSRP SourcePosiba`_^]\[ZYXQJafedc-sihg1#"!stuji1#uust SourcePosMaybesaaasttok GenParseraasttok GenParserbastsStreamPermParser>=aaamusParsecT6-,aamusParsecT5 ()musParsecT$CharmusParsecTFFFF$DoublemusParsecT$IntegermusParsecT$ $ $ $$amus OperatorTable amusParsecTroeL3210/.-,+*))('&% closemusParsecT3endmusParsecT*openmusParsecT3sepmusParsecT+tmusParsecT4DoubleIntegerEithermusParsecT$ Char[]musParsecT$$$$$$$a()sParsec"!astsParsecq>astsStreamPermParser<asttok GenParser@ausParsec#ausReplySmusGenLanguageDef musGenTokenParser usStatef;:987.astsParseca(,)p=Char[][ZJIHGFFFEEEEEDCBA10#! Message[]Et[]mtok[]amusParsecT[]?Char[][]F F/asttokOperator[][]@aIdentity()Char[]ParsecT vK@ݠlUB+ğ~G!ОŞD5&tV9ԜtCpG<̚gXM6+ Ι|T+ӘeK9֗˗qbK4ږ˖c7( ֕˕dQFҔ^-MonadmStreamsStreamtStringStreammStreamsStreamtStringStreammStreamsStreamtStringMonadm&Streams'StreamsStreammStreamsStreammStreamsEqtStreammStreamsStreamtStringMonadmMonadmStreammStreamsStreamtMonadm~StreammStreamsMonadmKPoopNLinemnMColumn"Line!ColumnString  SourceName$ SourceNameMonadmXY7bV5W6Un, efgStringL-StreammStreams>StreammStreamsStringrP SourceNameZ8dStringqColumnLine SourceNameyVX StringStringStreammStreamsStringMonadmStringrvStreammStreamsStreammStreamsString OperatorTable@!StreammStreams+ Streams* StreamsStreamsMonadmqsShowtStreammStreamsStreamt5StreammStreamsMonadmStreammStreams SourceName(uSMonadmStringvTMonadmString:<StreammStreams;=StreammStreams RS23StreammStreamsaStreammStreams)Monadm~\StreammStreamsStreammStreams_`StreammStreamsStreammStreamsStringStreams SourceNameShowaStreamsStreams SourceName8StreammStreamsStringString .67{ ZEF%& Mhs.FQjt[9?ADOj"$0HxStringkO SourceName9lm GHI'()*+,StringString klIJKLz{|}^StreammStreamsParserString234dBMonadm0ShowtStreammStreamsStreamta?MonadmMonadmcAMonadm-/Niz /GY]puStreammStreamsT4StreammStreamsb@MonadmeCh TokenParser Qfgt1DERi LanguageDefoWA+ͿsS9Ѿw=ӽ{U/ټwW5 }_E/ߺúc9ݹùe9Ǹe=ӷK۶eE ۵}c5ŴwQ) y[/ѲiM# ٱc?Y;{[;ծ{eK/ϭ]+լiK+ի_?S3cר{W7{U)tXB* ¥j<ؤʤ|Ф| whitespace whiteSpaceupperupper updatestate& updateStateupdateposstringPupdatePosString updateposchar| updatePosCharupdateparserstateupdateParserState unknownerrorӥ unknownError unexpected unexpectedunexpectUnExpectuncons5unconstryJtrytokensctokens tokenprimex tokenPrimEx tokenprim tokenPrim tokenparser̦ TokenParsertokenTokentokentabtabsysunexpecterror>sysUnExpectError sysunexpecte SysUnExpectsymbolsymbol stringliteral stringLiteralstrinģStringstringstreampermparserStreamPermParser stateuser# stateUserstateposDstatePos stateinputf stateInputstateStatesquaressquaresspacesƨspacesspacespace sourcepos SourcePos% sourcename* SourceName# sourceName$ sourceliner sourceLine" sourcecolumn sourceColumn! skipmany1ͩ skipMany1skipmanyskipManyshowerrormessagesshowErrorMessagessetstate@setState setsourcenamee setSourceName  setsourceline setSourceLinesetsourcecolumn˪setSourceColumn setposition setPositionsetparserstate&setParserStatesetinputLsetInput seterrorposo setErrorPosseterrormessagesetErrorMessage sependby1 sepEndBy1sependbysepEndBysepby1sepBy1sepbysepBysemisep18semiSep1semisepWsemiSepsemirsemisatisfysatisfyrunptrunPT runparsertĬ runParserT runparser runParser runparsect runParsecTrunp runPreservedopnames?reservedOpNames reservedopl reservedOp reservednames reservedNamesreservedreservedreply٭ReplypzeropzeroputstateputStateprim Primprefix:PrefixpostfixWPostfixposmPospermutepermute permparser PermParserpermƮPerm parsetest parseTest parserzero parserZero parserreturn( parserReturn parserplusJ parserPlus parserfailj parserFail parserbind parserBindparserParser parsefromfileѯ parseFromFile parseerror ParseErrorparsect)ParsecT parsecmapI parsecMapparsecdParsec parsecparseparseparensparens optionmaybe˰ optionMaybeoptionaloptionaloption option~opstart)opStart|}opletterLopLetterz{ operatortableu OperatorTableyoperatorOperatorwoperatorxoneofɱoneOfvokOkoctdigitoctDigituoctaloctalt notfollowedby5 notFollowedBysnoneofXnoneOfrnewpostnewPosqnewlinenewlinepnewerrorunknownnewErrorUnknownonewerrormessagenewErrorMessagennestedcommentsnestedCommentslmnaturalorfloatBnaturalOrFloatknaturalgnaturalj mondriandef mondrianDefimondrianmondrianh modifystateϳ modifyState messagestring messageStringg messageeq messageEqfmessagecompare<messageCompareemessage]MessagecdmergeerrorreplymergeErrorReply mergeerror mergeErrorbmanytillҴmanyTilla manyaccum manyAccummany1 many1`many&many_maketokenparserImakeTokenParser^lowermlower] lookahead lookAhead~\lineLine|}[lexemeʵlexeme{ZletterletterzYlazyLazy languagedef LanguageDefwxyUVWXlanguageRLanguage labelsplabelsvTlabellabeluS javastyle javaStyletRintegerɶintegersQ initialpos initialPosrPinfix InfixqO incsourceline+ incSourceLineopNincsourcecolumn_incSourceColumnmnM identstart identStartlKL identletter identLetterkIJ identifier identifierjHhexdigithexDigitiG hexadecimal' hexadecimalhF haskellstyleN haskellStylegE haskelldeft haskellDeffDhaskellhaskelleCgetstategetStatedB getposition׸ getPositioncAgetparserstategetParserStateb@getinput&getInputa?gentokenparserLGenTokenParser`> genparsers GenParser^_<=genlanguagedefGenLanguageDef\]:;float͹float[9exprExprexpectExpectZ8errorposerrorPosXY7 errormessagesK errorMessagesW6errorisunknownverrorIsUnknownV5errorErrorUeofeofT4endby1κendBy1S3endbyendByR2emptydefemptyDefQ1empty#EmptyPdot7dotO0digitOdigitN/decimalkdecimalM.countcountL-consumedConsumedJK commentstartȻ commentStartI+, commentline commentLineH)* commentend commentEndG'( commasep1C commaSep1F&commasepdcommaSepE%commacommaD$ combinator CombinatorcolumnColumnBC#coloncolonA"choicechoice@! charparser CharParser  charliteral? charLiteral?char^Charchar>chainr1chainr1=chainrchainr<chainl1chainl1;chainl޽chainl: casesensitive caseSensitive9 bytestring, ByteStringbuildexpressionparserWbuildExpressionParser8bracketsbrackets7bracesbraces6betweenbetween5 assocright AssocRight4 assocnone AssocNone3 assocleft% AssocLeft2assocCAssoc1anytoken`anyToken0anycharanyChar/anglesangles. alphanumalphaNum- adderrormessageaddErrorMessage, <||><||>+ <|?><|?>* <|>3<|>)I(<$?>`<$?>'<$$>x<$$>&J+vrJM$TLgV~P&o6g6gOӶK7z.WoJ0!,pv|ɏeMn؇8:N-d~Z~}|y{{z|xawOvuttGsrqonmmlUlJjlifeedc_^\[YkXWlS SoRPOPON;LoKJ[JIH$GDBBsA @ ? =;K:49C75L43s0&0a/g.-#,*3(%%@%W$#"Z" ? J8  Q L f-+Y**B V46>o,?j?Ncuj~nY|7C b+\zx+خI#># K۞WdǑߏO@  V~\}|{I{ywv9vuttCsAr?qppoFoynmmlljihfedcnba`,`D_L]8\}[ZUZJXWUTQwQ~POKIHE"E@q@?g?>P>=<<:p98 8765Y4N1)0G/--+?+)3('&$"!DQ^S!l " k   lgHF tEE]3y{=$*n 8q\UxOm whiteSpace whiteSpace :: GenTokenParser s u m -> ParsecT s u m ()FGenTokenParsersumParsecTsum()#Parses any white space. White space consists of zero or more occurrences of a space, a line comment or a block (multi line) comment. Block comments may be nested. How comments are started and ended is defined in the LanguageDef that is passed to makeTokenParser. upperupper :: Stream s m Char => ParsecT s u m CharStreamsmCharParsecTsumChar]Parses an upper case letter (a character between 'A' and 'Z'). Returns the parsed character.  updateState updateState ::  Monad m => (u -> u) -> ParsecT s u m ()MonadmuuParsecTsum()6An alias for modifyState for backwards compatibility.  updatePosStringupdatePosString ::  SourcePos -> String ->  SourcePos SourcePosString SourcePosThe expression updatePosString pos s updates the source position pos by calling updatePosChar on every character in s, ie. foldl updatePosChar pos string.  updatePosChar updatePosChar ::  SourcePos -> Char ->  SourcePos SourcePosChar SourcePosQUpdate a source position given a character. If the character is a newline ('\n') or carriage return ('\r') the line number is incremented by 1. If the character is a tab ('t') the column number is incremented to the nearest 8'th column, ie. column + 8 - ((column-1) `mod` 8). In all other cases, the column is incremented by 1.  unexpected unexpected :: Stream s m t => String -> ParsecT s u m aStreamsmtStringParsecTsumaThe parser unexpected msg always fails with an unexpected error message msg without consuming any input. The parsers fail, (<?>) and unexpected are the three parsers used to generate error messages. Of these, only (<?>) is commonly used. For an example of the use of unexpected, see the definition of Text.Parsec.Combinator.notFollowedBy. UnExpectUnExpect :: String -> MessageStringMessagetrytry :: GenParser tok st a -> GenParser tok st a{F GenParsertoksta GenParsertokstatokens tokens :: (Stream s m t, Eq t) => ([t] -> String) -> (SourcePos -> [t] -> SourcePos) -> [t] -> ParsecT s u m [t]*StreamsmtEqt[]tString SourcePos[]t SourcePos[]tParsecTsum[]t tokenPrimEx  tokenPrimEx :: Stream s m t =>  (t -> String) -> "(SourcePos -> t -> s -> SourcePos) -> %Maybe (SourcePos -> t -> s -> u -> u) -> (t -> Maybe a) -> ParsecT s u m aStreamsmttString SourcePosts SourcePosMaybe SourcePostsuutMaybeaParsecTsuma tokenPrim  tokenPrim :: Stream s m t =>  (t -> String) -> "(SourcePos -> t -> s -> SourcePos) -> (t -> Maybe a) -> ParsecT s u m a:StreamsmttString SourcePosts SourcePostMaybeaParsecTsumaThe parser token showTok nextPos testTok accepts a token t with result x when the function testTok t returns Just x. The token can be shown using showTok t. The position of the next token should be returned when nextPos is called with the current source position pos, the current token t and the rest of the tokens toks, nextPos pos t toks. This is the most primitive combinator for accepting tokens. For example, the Text.Parsec.Char.char parser could be implemented as:
char c
  = tokenPrim showChar nextPos testChar
  where
    showChar x        = "'" ++ x ++ "'"
    testChar x        = if x == c then Just x else Nothing
    nextPos pos x xs  = updatePosChar pos x
 TokenParser> TokenParser :: ParsecT s u m String -> (String -> ParsecT s u m ()) -> ParsecT s u m String -> (String -> ParsecT s u m ()) -> ParsecT s u m Char -> ParsecT s u m String -> ParsecT s u m Integer -> ParsecT s u m Integer -> ParsecT s u m Double ->  %ParsecT s u m (Either Integer Double) ->  ParsecT s u m Integer ->  ParsecT s u m Integer ->  ParsecT s u m Integer ->  (String -> ParsecT s u m String) -> $(ParsecT s u m a -> ParsecT s u m a) -> ParsecT s u m () -> $(ParsecT s u m a -> ParsecT s u m a) -> $(ParsecT s u m a -> ParsecT s u m a) -> $(ParsecT s u m a -> ParsecT s u m a) -> $(ParsecT s u m a -> ParsecT s u m a) -> $(ParsecT s u m a -> ParsecT s u m a) -> ParsecT s u m String -> ParsecT s u m String -> ParsecT s u m String -> ParsecT s u m String -> &(ParsecT s u m a -> ParsecT s u m [a]) -> &(ParsecT s u m a -> ParsecT s u m [a]) -> &(ParsecT s u m a -> ParsecT s u m [a]) -> &(ParsecT s u m a -> ParsecT s u m [a]) -> GenTokenParser s u mmParsecTsumStringStringParsecTsum()ParsecTsumStringStringParsecTsum()ParsecTsumCharParsecTsumStringParsecTsumIntegerParsecTsumIntegerParsecTsumDoubleParsecTsumEitherIntegerDoubleParsecTsumIntegerParsecTsumIntegerParsecTsumIntegerStringParsecTsumStringParsecTsumaParsecTsumaParsecTsum()ParsecTsumaParsecTsumaParsecTsumaParsecTsumaParsecTsumaParsecTsumaParsecTsumaParsecTsumaParsecTsumaParsecTsumaParsecTsumStringParsecTsumStringParsecTsumStringParsecTsumStringParsecTsumaParsecTsum[]aParsecTsumaParsecTsum[]aParsecTsumaParsecTsum[]aParsecTsumaParsecTsum[]aGenTokenParsersum TokenParsertype  TokenParser st$ = GenTokenParser String st Identitytoken token :: Stream s Identity t =>  (t -> String) -> (t -> SourcePos) -> (t -> Maybe a) ->  Parsec s u aqStreamsIdentityttStringt SourcePostMaybeaParsecsuaThe parser token showTok posFromTok testTok accepts a token t with result x when the function testTok t returns Just x. The source position of the t should be returned by posFromTok t and the token can be shown using showTok t. This combinator is expressed in terms of tokenPrim. It is used to accept user defined token streams. For example, suppose that we have a stream of basic tokens tupled with source positions. We can than define a parser that accepts single tokens as:
mytoken x
  = token showTok posFromTok testTok
  where
    showTok (pos,t)     = show t
    posFromTok (pos,t)  = pos
    testTok (pos,t)     = if x == t then Just t else Nothing
tabtab :: Stream s m Char => ParsecT s u m CharEStreamsmCharParsecTsumChar8Parses a tab character ('\t'). Returns a tab character.  SysUnExpect SysUnExpect :: String -> MessageStringMessage symbolsymbol :: GenTokenParser s u m -> String -> ParsecT s u m String\GenTokenParsersumStringParsecTsumString`Lexeme parser symbol s parses string s and skips trailing white space.  stringLiteral stringLiteral :: GenTokenParser s u m -> ParsecT s u m StringqGenTokenParsersumParsecTsumStringThis lexeme parser parses a literal string. Returns the literal string value. This parsers deals correctly with escape sequences and gaps. The literal string is parsed according to the grammar rules defined in the Haskell report (which matches most programming languages quite closely). stringstring :: Stream s m Char => String -> ParsecT s u m Stringq4StreamsmCharStringParsecTsumStringstring s parses a sequence of characters given by s. Returns the parsed string (i.e. s).
divOrMod    =   string "div" 
            <|> string "mod"
 stateUser stateUser ::  State s u -> uStatesuustatePosstatePos ::  State s u ->  SourcePosStatesu SourcePos stateInput stateInput ::  State s u -> sjUStatesusState State :: s ->  SourcePos -> u ->  State s us SourcePosuStatesuStatedata State s u& squaressquares :: GenTokenParser s u m -> ParsecT s u m a -> ParsecT s u m aGenTokenParsersumParsecTsumaParsecTsuma!DEPRECATED: Use brackets. spacesspaces :: Stream s m Char => ParsecT s u m ()dStreamsmCharParsecTsum()LSkips zero or more white space characters. See also skipMany. spacespace :: Stream s m Char => ParsecT s u m Chard3StreamsmCharParsecTsumCharlParses a white space character (any character which satisfies isSpace) Returns the parsed character.  SourcePosdata  SourcePosThe abstract data type SourcePos represents source positions. It contains the name of the source (i.e. file name), a line number and a column number. SourcePos is an instance of the Show, Eq and Ord class.  sourceName sourceName ::  SourcePos ->  SourceNamemS SourcePos SourceName8Extracts the name of the source from a source position.  SourceNametype  SourceName = String sourceLine sourceLine ::  SourcePos -> LineN: SourcePosLine1Extracts the line number from a source position.  sourceColumn sourceColumn ::  SourcePos -> Column SourcePosColumn3Extracts the column number from a source position.  skipMany1 skipMany1 :: Stream s m t => ParsecT s u m a -> ParsecT s u m ()StreamsmtParsecTsumaParsecTsum()bskipMany1 p applies the parser p one or more times, skipping its result. skipManyskipMany :: Stream s m t => ParsecT s u m a -> ParsecT s u m ()StreamsmtParsecTsumaParsecTsum()skipMany p applies the parser p zero or more times, skipping its result.
spaces  = skipMany space
showErrorMessagesshowErrorMessages :: String -> String -> String -> String -> String ->  [Message] -> Stringu3StringStringStringStringString[]MessageStringsetStatesetState ::  Monad m => u -> ParsecT s u m ()MonadmuParsecTsum()3An alias for putState for backwards compatibility.  setSourceName setSourceName ::  SourcePos ->  SourceName ->  SourcePos SourcePos SourceName SourcePosSet the name of the source.  setSourceLine setSourceLine ::  SourcePos -> Line ->  SourcePosoP SourcePosLine SourcePos*Set the line number of a source position.  setSourceColumnsetSourceColumn ::  SourcePos -> Column ->  SourcePos-  SourcePosColumn SourcePos,Set the column number of a source position.  setPosition setPosition ::  Monad m =>  SourcePos -> ParsecT s u m ()Monadm SourcePosParsecTsum()KsetPosition pos sets the current source position to pos. setParserStatesetParserState ::  Monad m =>  State s u -> ParsecT s u m (State s u)MonadmStatesuParsecTsumStatesuEsetParserState st set the full parser state to st. setInputsetInput ::  Monad m => s -> ParsecT s u m ()MonadmsParsecTsum()setInput input continues parsing with input. The getInput and setInput functions can for example be used to deal with #include files.  setErrorPos setErrorPos ::  SourcePos ->  ParseError ->  ParseError SourcePos ParseError ParseErrorsetErrorMessagesetErrorMessage :: Message ->  ParseError ->  ParseError|Message ParseError ParseError sepEndBy1 sepEndBy1 :: Stream s m t => ParsecT s u m a -> ParsecT s u m sep -> ParsecT s u m [a]0StreamsmtParsecTsumaParsecTsumsepParsecTsum[]asepEndBy1 p sep parses one or more occurrences of p, separated and optionally ended by sep. Returns a list of values returned by p. sepEndBysepEndBy :: Stream s m t => ParsecT s u m a -> ParsecT s u m sep -> ParsecT s u m [a]3StreamsmtParsecTsumaParsecTsumsepParsecTsum[]asepEndBy p sep parses zero or more occurrences of p, separated and optionally ended by sep, ie. haskell style statements. Returns a list of values returned by p.
haskellStatements  = haskellStatement `sepEndBy` semi
sepBy1sepBy1 :: Stream s m t => ParsecT s u m a -> ParsecT s u m sep -> ParsecT s u m [a]1StreamsmtParsecTsumaParsecTsumsepParsecTsum[]asepBy1 p sep parses one or more occurrences of p, separated by sep. Returns a list of values returned by p. sepBysepBy :: Stream s m t => ParsecT s u m a -> ParsecT s u m sep -> ParsecT s u m [a]PStreamsmtParsecTsumaParsecTsumsepParsecTsum[]asepBy p sep parses zero or more occurrences of p, separated by sep. Returns a list of values returned by p.
commaSep p  = p `sepBy` (symbol ",")
 semiSep1semiSep1 :: GenTokenParser s u m -> ParsecT s u m a -> ParsecT s u m [a]PGenTokenParsersumParsecTsumaParsecTsum[]aLexeme parser semiSep1 p parses one or more occurrences of p separated by semi. Returns a list of values returned by p.  semiSepsemiSep :: GenTokenParser s u m -> ParsecT s u m a -> ParsecT s u m [a]pGenTokenParsersumParsecTsumaParsecTsum[]aLexeme parser semiSep p parses zero or more occurrences of p separated by semi. Returns a list of values returned by p.  semisemi :: GenTokenParser s u m -> ParsecT s u m StringGenTokenParsersumParsecTsumStringjLexeme parser |semi| parses the character ';' and skips any trailing white space. Returns the string ";". satisfysatisfy :: Stream s m Char => (Char -> Bool) -> ParsecT s u m Char StreamsmCharCharBoolParsecTsumCharThe parser satisfy f succeeds for any character for which the supplied function f returns True. Returns the character that is actually parsed.  runParser  runParser :: GenParser tok st a -> st ->  SourceName -> [tok] -> Either ParseError a `  GenParsertokstast SourceName[]tokEither ParseErrora reservedOpNamesreservedOpNames :: GenLanguageDef s u m -> [String]G  GenLanguageDefsum[]String The list of reserved operators. reservedOpNamesreservedOpNames :: GenLanguageDef s u m -> [String]  GenLanguageDefsum[]String The list of reserved operators.  reservedOp reservedOp :: GenTokenParser s u m -> String -> ParsecT s u m ()  GenTokenParsersumStringParsecTsum()The lexeme parser reservedOp name parses symbol name, but it also checks that the name is not a prefix of a valid operator. A reservedOp is treated as a single token using try.  reservedNames reservedNames :: GenLanguageDef s u m -> [String]FGenLanguageDefsum[]String"The list of reserved identifiers.  reservedNames reservedNames :: GenLanguageDef s u m -> [String]GenLanguageDefsum[]String"The list of reserved identifiers.  reservedreserved :: GenTokenParser s u m -> String -> ParsecT s u m ()GenTokenParsersumStringParsecTsum()The lexeme parser reserved name parses symbol name, but it also checks that the name is not a prefix of a valid identifier. A reserved word is treated as a single token using try. pzeropzero :: GenParser tok st a  GenParsertokstaPrefixPrefix :: GenParser tok st (a -> a) -> Operator tok st as GenParsertokstaaOperatortokstapermutepermute :: Stream s Identity tok => StreamPermParser s st a ->  Parsec s st ay(StreamsIdentitytokStreamPermParsersstaParsecsstaThe parser permute perm parses a permutation of parser described by perm. For example, suppose we want to parse a permutation of: an optional string of a's, the character b and an optional c. This can be described by:
test  = permute (tuple <$?> ("",many1 (char 'a'))
                       <||> char 'b' 
                       <|?> ('_',char 'c'))
      where
        tuple a b c  = (a,b,c)
 PermParsertype  PermParser tok st a = StreamPermParser String st a?Provided for backwards compatibility. The tok type is ignored.  parseTest parseTest :: !(Stream s Identity t, Show a) =>  Parsec s () a -> s -> IO ()sStreamsIdentitytShowaParsecs()asIO()The expression parseTest p input applies a parser p against input input and prints the result to stdout. Used for testing parsers. Parsertype Parser = Parsec String () Parsertype Parser = Parsec ByteString () parseFromFile parseFromFile :: Parser a -> String -> IO (Either ParseError a)eParseraStringIOEither ParseErroraparseFromFile p filePath runs a string parser p on the input read from filePath using readFile. Returns either a ParseError (Left) or a value of type a (Right).
main    = do{ result <- parseFromFile numbers "digits.txt"
            ; case result of
                Left err  -> print err
                Right xs  -> print (sum xs)
            }
 parseFromFile parseFromFile :: Parser a -> String -> IO (Either ParseError a)ParseraStringIOEither ParseErroraparseFromFile p filePath runs a lazy bytestring parser p on the input read from filePath using ByteString.Lazy.Char8.readFile. Returns either a ParseError (Left) or a value of type a (Right).
main    = do{ result <- parseFromFile numbers "digits.txt"
            ; case result of
                Left err  -> print err
                Right xs  -> print (sum xs)
            }
 ParseErrordata  ParseError>The abstract data type ParseError represents parse errors. It provides the source position (SourcePos) of the error and a list of error messages (Message). A ParseError can be returned by the function Text.Parsec.Prim.parse. ParseError is an instance of the Show class. parse parse :: Stream s Identity t =>  Parsec s () a ->  SourceName -> s -> Either ParseError a.StreamsIdentitytParsecs()a SourceNamesEither ParseErroraparse p filePath input runs a parser p over Identity without user state. The filePath is only used in error messages and may be the empty string. Returns either a ParseError (Left) or a value of type a (Right).
main    = case (parse numbers "" "11, 2, 43") of
           Left err  -> print err
           Right xs  -> print (sum xs)

numbers = commaSep integer
 parensparens :: GenTokenParser s u m -> ParsecT s u m a -> ParsecT s u m a _ GenTokenParsersumParsecTsumaParsecTsumanLexeme parser parens p parses p enclosed in parenthesis, returning the value of p.  optionMaybe optionMaybe :: Stream s m t => ParsecT s u m a -> ParsecT s u m (Maybe a)!!StreamsmtParsecTsumaParsecTsumMaybeaoption p tries to apply parser p. If p fails without consuming input, it return Nothing, otherwise it returns Just the value returned by p. optionaloptional :: Stream s m t => ParsecT s u m a -> ParsecT s u m ()V##StreamsmtParsecTsumaParsecTsum()optional p tries to apply parser p. It will parse p or nothing. It only fails if p fails after consuming input. It discards the result of p. optionoption :: Stream s m t => a -> ParsecT s u m a -> ParsecT s u m a$$StreamsmtaParsecTsumaParsecTsuma2option x p tries to apply parser p. If p fails without consuming input, it returns the value x, otherwise the value returned by p.
priority  = option 0 (do{ d <- digit
                        ; return (digitToInt d) 
                        })
 opStartopStart :: GenLanguageDef s u m -> ParsecT s u m Char&f&GenLanguageDefsumParsecTsumCharzThis parser should accept any start characters of operators. For example oneOf ":!#$%&*+./<=>?@\\^|-~" opStartopStart :: GenLanguageDef s u m -> ParsecT s u m Char'}'GenLanguageDefsumParsecTsumCharzThis parser should accept any start characters of operators. For example oneOf ":!#$%&*+./<=>?@\\^|-~"  opLetteropLetter :: GenLanguageDef s u m -> ParsecT s u m Char((GenLanguageDefsumParsecTsumCharThis parser should accept any legal tail characters of operators. Note that this parser should even be defined if the language doesn't support user-defined operators, or otherwise the reservedOp parser won't work correctly. opLetteropLetter :: GenLanguageDef s u m -> ParsecT s u m CharT**GenLanguageDefsumParsecTsumCharThis parser should accept any legal tail characters of operators. Note that this parser should even be defined if the language doesn't support user-defined operators, or otherwise the reservedOp parser won't work correctly.  OperatorTabletype  OperatorTable tok st a = [[Operator tok st a]]+ operatoroperator :: GenTokenParser s u m -> ParsecT s u m String?,,GenTokenParsersumParsecTsumString_This lexeme parser parses a legal operator. Returns the name of the operator. This parser will fail on any operators that are reserved operators. Legal operator (start) characters and reserved operators are defined in the LanguageDef that is passed to makeTokenParser. An operator is treated as a single token using try. Operatordata Operator tok st a-oneOfoneOf :: Stream s m Char => [Char] -> ParsecT s u m Char.A.StreamsmChar[]CharParsecTsumCharoneOf cs succeeds if the current character is in the supplied list of characters cs. Returns the parsed character. See also satisfy.
vowel  = oneOf "aeiou"
octDigitoctDigit :: Stream s m Char => ParsecT s u m Char//StreamsmCharParsecTsumCharWParses an octal digit (a character between '0' and '7'). Returns the parsed character.  octaloctal :: GenTokenParser s u m -> ParsecT s u m Integer00GenTokenParsersumParsecTsumIntegerParses a positive whole number in the octal system. The number should be prefixed with "0o" or "0O". Returns the value of the number.  notFollowedBy notFollowedBy :: (Stream s m t, Show t) => ParsecT s u m t -> ParsecT s u m ()21StreamsmtShowtParsecTsumtParsecTsum()7notFollowedBy p only succeeds when parser p fails. This parser does not consume any input. This parser can be used to implement the 'longest match' rule. For example, when recognizing keywords (for example let), we want to make sure that a keyword is not followed by a legal identifier character, in which case the keyword is actually an identifier (for example lets). We can program this behaviour as follows:
keywordLet  = try (do{ string "let"
                     ; notFollowedBy alphaNum
                     })
noneOfnoneOf :: Stream s m Char => [Char] -> ParsecT s u m Char44StreamsmChar[]CharParsecTsumCharAs the dual of oneOf, noneOf cs succeeds if the current character not in the supplied list of characters cs. Returns the parsed character.
consonant = noneOf "aeiou"
 newPos newPos ::  SourceName -> Line -> Column ->  SourcePosj6B6 SourceNameLineColumn SourcePosYCreate a new SourcePos with the given source name, line number and column number. newlinenewline :: Stream s m Char => ParsecT s u m CharL77StreamsmCharParsecTsumChar@Parses a newline character ('\n'). Returns a newline character. newErrorUnknownnewErrorUnknown ::  SourcePos ->  ParseError87 SourcePos ParseErrornewErrorMessagenewErrorMessage :: Message ->  SourcePos ->  ParseError8}8Message SourcePos ParseError nestedCommentsnestedComments :: GenLanguageDef s u m -> Bool)99GenLanguageDefsumBoolCSet to True if the language supports nested block comments. nestedCommentsnestedComments :: GenLanguageDef s u m -> Bool99GenLanguageDefsumBoolCSet to True if the language supports nested block comments.  naturalOrFloatnaturalOrFloat :: GenTokenParser s u m -> %ParsecT s u m (Either Integer Double) ;:GenTokenParsersumParsecTsumEitherIntegerDouble This lexeme parser parses either natural or a float. Returns the value of the number. This parsers deals with any overlap in the grammar rules for naturals and floats. The number is parsed according to the grammar rules defined in the Haskell report.  naturalnatural :: GenTokenParser s u m -> ParsecT s u m Integer<|<GenTokenParsersumParsecTsumIntegerThis lexeme parser parses a natural number (a positive whole number). Returns the value of the number. The number can be specified in decimal, hexadecimal or octal. The number is parsed according to the grammar rules in the Haskell report.  mondrianDef mondrianDef :: LanguageDef st>> LanguageDefst3The language definition for the language Mondrian. mondrianmondrian :: TokenParser st>> TokenParserst#A lexer for the mondrian language.  messageString messageString :: Message -> String2??MessageString1Extract the message string from an error message  messageEq messageEq :: Message -> Message -> Bool??MessageMessageBoolmessageComparemessageCompare :: Message -> Message -> Orderingm@N@MessageMessageOrderingMessageMessage :: String -> Message@@StringMessageMessagedata Message@This abstract data type represents parse error messages. There are four kinds of messages:
data Message = SysUnExpect String
             | UnExpect String
             | Expect String
             | Message String
The fine distinction between different kinds of parse errors allows the system to generate quite good error messages for the user. It also allows error messages that are formatted in different languages. Each kind of message is generated by different combinators:  mergeError mergeError ::  ParseError ->  ParseError ->  ParseErrorEE ParseError ParseError ParseErrormanyTillmanyTill :: Stream s m t => ParsecT s u m a -> ParsecT s u m end -> ParsecT s u m [a]FBFStreamsmtParsecTsumaParsecTsumendParsecTsum[]amanyTill p end applies parser p zero or more times until parser end succeeds. Returns the list of values returned by p. This parser can be used to scan comments:
simpleComment   = do{ string "<!--"
                    ; manyTill anyChar (try (string "-->"))
                    }
Note the overlapping parsers anyChar and string "<!--", and therefore the use of the try combinator. many1many1 :: Stream s m t => ParsecT s u m a -> ParsecT s u m [a]3IHStreamsmtParsecTsumaParsecTsum[]amany p applies the parser p one or more times. Returns a list of the returned values of p.
word  = many1 letter
manymany :: Stream s m t => ParsecT s u m a -> ParsecT s u m [a]Jmany p applies the parser p zero or more times. Returns a list of the returned values of p.
identifier  = do{ c  <- letter
                ; cs <- many (alphaNum <|> char '_')
                ; return (c:cs)
                }
 makeTokenParsermakeTokenParser :: Stream s m Char => GenLanguageDef s u m -> GenTokenParser s u m}L.LStreamsmCharGenLanguageDefsumGenTokenParsersumThe expression makeTokenParser language creates a GenTokenParser record that contains lexical parsers that are defined using the definitions in the language record. The use of this function is quite stylized - one imports the appropiate language definition and selects the lexical parsers that are needed from the resulting GenTokenParser.
module Main where

import Text.Parsec
import qualified Text.Parsec.Token as P
import Text.Parsec.Language (haskellDef)

-- The parser
...

expr  =   parens expr
      <|> identifier
      <|> ...
     

-- The lexer
lexer       = P.makeTokenParser haskellDef    
    
parens      = P.parens lexer
braces      = P.braces lexer
identifier  = P.identifier lexer
reserved    = P.reserved lexer
...
lowerlower :: Stream s m Char => ParsecT s u m CharPOStreamsmCharParsecTsumChar_Parses a lower case character (a character between 'a' and 'z'). Returns the parsed character.  lookAhead lookAhead :: Stream s m t => ParsecT s u m a -> ParsecT s u m a/QPStreamsmtParsecTsumaParsecTsumaDlookAhead p parses p without consuming any input.  Linetype Line = IntQ lexemelexeme :: GenTokenParser s u m -> ParsecT s u m a -> ParsecT s u m anR"RGenTokenParsersumParsecTsumaParsecTsumalexeme p first applies parser p and than the whiteSpace parser, returning the value of p. Every lexical token (lexeme) is defined using lexeme, this way every parse starts at a point without white space. Parsers that use lexeme are called lexeme parsers in this document. The only point where the whiteSpace parser should be called explicitly is the start of the main parser in order to skip any leading white space.
mainParser  = do{ whiteSpace
                 ; ds <- many (lexeme digit)
                 ; eof
                 ; return (sum ds)
                 }
letterletter :: Stream s m Char => ParsecT s u m CharUPUStreamsmCharParsecTsumCharWParses a letter (an upper case or lower case character). Returns the parsed character.  LanguageDef LanguageDef :: String -> String -> String -> Bool -> ParsecT s u m Char -> ParsecT s u m Char -> ParsecT s u m Char -> ParsecT s u m Char -> [String] ->  [String] ->  Bool -> GenLanguageDef s u mWW StringStringStringBoolParsecTsumCharParsecTsumCharParsecTsumCharParsecTsumChar[]String[]StringBoolGenLanguageDefsum LanguageDeftype  LanguageDef st$ = GenLanguageDef String st IdentityFX LanguageDef LanguageDef :: String -> String -> String -> Bool -> ParsecT s u m Char -> ParsecT s u m Char -> ParsecT s u m Char -> ParsecT s u m Char -> [String] ->  [String] ->  Bool -> GenLanguageDef s u mQZY StringStringStringBoolParsecTsumCharParsecTsumCharParsecTsumCharParsecTsumChar[]String[]StringBoolGenLanguageDefsum LanguageDeftype  LanguageDef st$ = GenLanguageDef String st IdentityZlabelslabels ::  Monad m => ParsecT s u m a -> [String] -> ParsecT s u m ay[.[MonadmParsecTsuma[]StringParsecTsumalabellabel ::  Monad m => ParsecT s u m a -> String -> ParsecT s u m a4\[MonadmParsecTsumaStringParsecTsuma javaStyle javaStyle :: LanguageDef st\y\ LanguageDefstThis is a minimal token definition for Java style languages. It defines the style of comments, valid identifiers and case sensitivity. It does not define any reserved words or operators.  integerinteger :: GenTokenParser s u m -> ParsecT s u m Integer]]GenTokenParsersumParsecTsumIntegerUThis lexeme parser parses an integer (a whole number). This parser is like natural except that it can be prefixed with sign (i.e. '-' or '+'). Returns the value of the number. The number can be specified in decimal, hexadecimal or octal. The number is parsed according to the grammar rules in the Haskell report.  initialPos initialPos ::  SourceName ->  SourcePos__ SourceName SourcePosvCreate a new SourcePos with the given source name, and line number and column number set to 1, the upper left. InfixInfix :: GenParser tok st (a -> a -> a) -> Assoc -> Operator tok st a`` GenParsertokstaaaAssocOperatortoksta incSourceLine incSourceLine ::  SourcePos -> Line ->  SourcePosraSa SourcePosLine SourcePos1Increments the line number of a source position.  incSourceColumnincSourceColumn ::  SourcePos -> Column ->  SourcePos7bb SourcePosColumn SourcePos3Increments the column number of a source position.  identStart identStart :: GenLanguageDef s u m -> ParsecT s u m Char cbGenLanguageDefsumParsecTsumCharoThis parser should accept any start characters of identifiers. For example letter <|> char "_".  identStart identStart :: GenLanguageDef s u m -> ParsecT s u m ChardcGenLanguageDefsumParsecTsumCharoThis parser should accept any start characters of identifiers. For example letter <|> char "_".  identLetter identLetter :: GenLanguageDef s u m -> ParsecT s u m Char3edGenLanguageDefsumParsecTsumCharvThis parser should accept any legal tail characters of identifiers. For example alphaNum <|> char "_".  identLetter identLetter :: GenLanguageDef s u m -> ParsecT s u m CharNffGenLanguageDefsumParsecTsumCharvThis parser should accept any legal tail characters of identifiers. For example alphaNum <|> char "_".  identifier identifier :: GenTokenParser s u m -> ParsecT s u m Stringkg1gGenTokenParsersumParsecTsumStringXThis lexeme parser parses a legal identifier. Returns the identifier string. This parser will fail on identifiers that are reserved words. Legal identifier (start) characters and reserved words are defined in the LanguageDef that is passed to makeTokenParser. An identifier is treated as a single token using try. hexDigithexDigit :: Stream s m Char => ParsecT s u m CharNiiStreamsmCharParsecTsumCharsParses a hexadecimal digit (a digit or a letter between 'a' and 'f' or 'A' and 'F'). Returns the parsed character.  hexadecimal hexadecimal :: GenTokenParser s u m -> ParsecT s u m Integerlj1jGenTokenParsersumParsecTsumIntegerParses a positive whole number in the hexadecimal system. The number should be prefixed with "0x" or "0X". Returns the value of the number.  haskellStyle haskellStyle :: LanguageDef stWkCk LanguageDefstThis is a minimal token definition for Haskell style languages. It defines the style of comments, valid identifiers and case sensitivity. It does not define any reserved words or operators.  haskellDef haskellDef :: LanguageDef stpl\l LanguageDefst2The language definition for the Haskell language. haskellhaskell :: TokenParser stll TokenParserst"A lexer for the haskell language. getStategetState ::  Monad m => ParsecT s u m umhmMonadmParsecTsumu Returns the current user state.  getPosition getPosition ::  Monad m => ParsecT s u m SourcePos5n nMonadmParsecTsum SourcePos@Returns the current source position. See also SourcePos. getParserStategetParserState ::  Monad m => ParsecT s u m (State s u) onMonadmParsecTsumStatesu8Returns the full parser state as a State record. getInputgetInput ::  Monad m => ParsecT s u m sooMonadmParsecTsumsReturns the current input  GenTokenParserdata GenTokenParser s u mpThe type of the record that holds lexical parsers that work on s streams with state u over a monad m.  GenParsertype  GenParser tok st = Parsec [tok] stp GenParsertype  GenParser t st = Parsec ByteString st;q GenLanguageDefdata GenLanguageDef s u mqThe GenLanguageDef type is a record that contains all parameterizable features of the Text.Parsec.Token module. The module Text.Parsec.Language contains some default definitions. GenLanguageDefdata GenLanguageDef s u mrThe GenLanguageDef type is a record that contains all parameterizable features of the Text.Parsec.Token module. The module Text.Parsec.Language contains some default definitions.  floatfloat :: GenTokenParser s u m -> ParsecT s u m DoublessGenTokenParsersumParsecTsumDoubleThis lexeme parser parses a floating point value. Returns the value of the number. The number is parsed according to the grammar rules defined in the Haskell report. ExpectExpect :: String -> MessagettStringMessageerrorPoserrorPos ::  ParseError ->  SourcePosNu4u ParseError SourcePos2Extracts the source position from the parse error  errorMessages errorMessages ::  ParseError ->  [Message]uu ParseError[]Message9Extracts the list of error messages from the parse error errorIsUnknownerrorIsUnknown ::  ParseError -> Boolvv ParseErrorBooleofeof :: (Stream s m t, Show t) => ParsecT s u m ()1wvStreamsmtShowtParsecTsum()This parser only succeeds at the end of the input. This is not a primitive parser but it is defined using notFollowedBy.
eof  = notFollowedBy anyToken <?> "end of input"
endBy1endBy1 :: Stream s m t => ParsecT s u m a -> ParsecT s u m sep -> ParsecT s u m [a]xxStreamsmtParsecTsumaParsecTsumsepParsecTsum[]aendBy1 p sep parses one or more occurrences of p, seperated and ended by sep. Returns a list of values returned by p. endByendBy :: Stream s m t => ParsecT s u m a -> ParsecT s u m sep -> ParsecT s u m [a]oz zStreamsmtParsecTsumaParsecTsumsepParsecTsum[]aendBy p sep parses zero or more occurrences of p, seperated and ended by sep. Returns a list of values returned by p.
cStatements  = cStatement `endBy` semi
emptyDefemptyDef :: LanguageDef st{{ LanguageDefst dotdot :: GenTokenParser s u m -> ParsecT s u m String5|{GenTokenParsersumParsecTsumStringpLexeme parser dot parses the character '.' and skips any trailing white space. Returns the string ".". digitdigit :: Stream s m Char => ParsecT s u m Char*}|StreamsmCharParsecTsumChar.Parses a digit. Returns the parsed character.  decimaldecimal :: GenTokenParser s u m -> ParsecT s u m Integer}}GenTokenParsersumParsecTsumIntegerWParses a positive whole number in the decimal system. Returns the value of the number. countcount :: Stream s m t => Int -> ParsecT s u m a -> ParsecT s u m [a]~StreamsmtIntParsecTsumaParsecTsum[]acount n p parses n occurrences of p. If n is smaller or equal to zero, the parser equals to return []. Returns a list of n values returned by p.  commentStart commentStart :: GenLanguageDef s u m -> StringtNGenLanguageDefsumStringDescribes the start of a block comment. Use the empty string if the language doesn't support block comments. For example "/*".  commentStart commentStart :: GenLanguageDef s u m -> String|VGenLanguageDefsumStringDescribes the start of a block comment. Use the empty string if the language doesn't support block comments. For example "/*".  commentLine commentLine :: GenLanguageDef s u m -> String\GenLanguageDefsumString}Describes the start of a line comment. Use the empty string if the language doesn't support line comments. For example "//".  commentLine commentLine :: GenLanguageDef s u m -> String`GenLanguageDefsumString}Describes the start of a line comment. Use the empty string if the language doesn't support line comments. For example "//".  commentEnd commentEnd :: GenLanguageDef s u m -> StringbGenLanguageDefsumString}Describes the end of a block comment. Use the empty string if the language doesn't support block comments. For example "*/".  commentEnd commentEnd :: GenLanguageDef s u m -> StringdGenLanguageDefsumString}Describes the end of a block comment. Use the empty string if the language doesn't support block comments. For example "*/".  commaSep1 commaSep1 :: GenTokenParser s u m -> ParsecT s u m a -> ParsecT s u m [a]܆GenTokenParsersumParsecTsumaParsecTsum[]aLexeme parser commaSep1 p parses one or more occurrences of p separated by comma. Returns a list of values returned by p.  commaSepcommaSep :: GenTokenParser s u m -> ParsecT s u m a -> ParsecT s u m [a]RGenTokenParsersumParsecTsumaParsecTsum[]aLexeme parser commaSep p parses zero or more occurrences of p separated by comma. Returns a list of values returned by p.  commacomma :: GenTokenParser s u m -> ParsecT s u m StringXGenTokenParsersumParsecTsumStringrLexeme parser comma parses the character ',' and skips any trailing white space. Returns the string ",".  Columntype Column = Int< coloncolon :: GenTokenParser s u m -> ParsecT s u m StringيGenTokenParsersumParsecTsumStringrLexeme parser colon parses the character ':' and skips any trailing white space. Returns the string ":". choicechoice :: Stream s m t => [ParsecT s u m a] -> ParsecT s u m aStreamsmt[]ParsecTsumaParsecTsumachoice ps tries to apply the parsers in the list ps in order, until one of them succeeds. Returns the value of the succeeding parser.  CharParsertype  CharParser st = GenParser Char st charLiteral charLiteral :: GenTokenParser s u m -> ParsecT s u m CharXGenTokenParsersumParsecTsumChar&This lexeme parser parses a single literal character. Returns the literal character value. This parsers deals correctly with escape sequences. The literal character is parsed according to the grammar rules defined in the Haskell report (which matches most programming languages quite closely). charchar :: Stream s m Char => Char -> ParsecT s u m CharQStreamsmCharCharParsecTsumCharchar c parses a single character c. Returns the parsed character (i.e. c).
semiColon  = char ';'
chainr1chainr1 :: Stream s m t => ParsecT s u m a -> ParsecT s u m (a -> a -> a) -> ParsecT s u m aҐoStreamsmtParsecTsumaParsecTsumaaaParsecTsumachainr1 p op x parser one or more occurrences of |p|, separated by op Returns a value obtained by a right associative application of all functions returned by op to the values returned by p. chainr chainr :: Stream s m t => ParsecT s u m a -> ParsecT s u m (a -> a -> a) -> a -> ParsecT s u m aȒbStreamsmtParsecTsumaParsecTsumaaaaParsecTsumaEchainr p op x parser zero or more occurrences of p, separated by op Returns a value obtained by a right associative application of all functions returned by op to the values returned by p. If there are no occurrences of p, the value x is returned. chainl1chainl1 :: Stream s m t => ParsecT s u m a -> ParsecT s u m (a -> a -> a) -> ParsecT s u m aStreamsmtParsecTsumaParsecTsumaaaParsecTsumachainl1 p op x parser one or more occurrences of p, separated by op Returns a value obtained by a left associative application of all functions returned by op to the values returned by p. . This parser can for example be used to eliminate left recursion which typically occurs in expression grammars.
expr    = term   `chainl1` mulop
term    = factor `chainl1` addop
factor  = parens expr <|> integer

mulop   =   do{ symbol "*"; return (*)   }
        <|> do{ symbol "/"; return (div) }

addop   =   do{ symbol "+"; return (+) }
        <|> do{ symbol "-"; return (-) }
chainl chainl :: Stream s m t => ParsecT s u m a -> ParsecT s u m (a -> a -> a) -> a -> ParsecT s u m a9StreamsmtParsecTsumaParsecTsumaaaaParsecTsumaGchainl p op x parser zero or more occurrences of p, separated by op. Returns a value obtained by a left associative application of all functions returned by op to the values returned by p. If there are zero occurrences of p, the value x is returned.  caseSensitive caseSensitive :: GenLanguageDef s u m -> BoolmIGenLanguageDefsumBool6Set to True if the language is case sensitive.  caseSensitive caseSensitive :: GenLanguageDef s u m -> Bool*GenLanguageDefsumBool6Set to True if the language is case sensitive. buildExpressionParserbuildExpressionParser :: OperatorTable tok st a -> GenParser tok st a -> GenParser tok st aS OperatorTabletoksta GenParsertoksta GenParsertoksta bracketsbrackets :: GenTokenParser s u m -> ParsecT s u m a -> ParsecT s u m aҜGenTokenParsersumParsecTsumaParsecTsuma{Lexeme parser brackets p parses p enclosed in brackets ('[' and ']'), returning the value of p.  bracesbraces :: GenTokenParser s u m -> ParsecT s u m a -> ParsecT s u m a`GenTokenParsersumParsecTsumaParsecTsumawLexeme parser braces p parses p enclosed in braces ('{' and '}'), returning the value of p. between between :: Stream s m t => ParsecT s u m open -> ParsecT s u m close -> ParsecT s u m a -> ParsecT s u m aStreamsmtParsecTsumopenParsecTsumcloseParsecTsumaParsecTsumabetween open close p parses open, followed by p and close. Returns the value returned by p.
braces  = between (symbol "{") (symbol "}")
 AssocRight AssocRight :: AssocAssoc AssocNone AssocNone :: AssocG?Assoc AssocLeft AssocLeft :: AssocAssocAssocdata AssocNThis data type specifies the associativity of operators: left, right or none. anyTokenanyToken :: (Stream s m t, Show t) => ParsecT s u m teStreamsmtShowtParsecTsumtThe parser anyToken accepts any kind of token. It is for example used to implement eof. Returns the accepted token. anyCharanyChar :: Stream s m Char => ParsecT s u m CharwStreamsmCharParsecTsumCharFThis parser succeeds for any character. Returns the parsed character.  anglesangles :: GenTokenParser s u m -> ParsecT s u m a -> ParsecT s u m aiGenTokenParsersumParsecTsumaParsecTsumaLexeme parser angles p parses p enclosed in angle brackets ('<' and '>'), returning the value of p. alphaNumalphaNum :: Stream s m Char => ParsecT s u m CharťStreamsmCharParsecTsumCharZParses a letter or digit (a character between '0' and '9'). Returns the parsed character. addErrorMessageaddErrorMessage :: Message ->  ParseError ->  ParseErrorMessage ParseError ParseError<||> (<||>) :: Stream s Identity tok => StreamPermParser s st (a -> b) ->  Parsec s st a -> StreamPermParser s st bӧ_StreamsIdentitytokStreamPermParsersstabParsecsstaStreamPermParsersstbThe expression perm <||> p adds parser p to the permutation parser perm. The parser p is not allowed to accept empty input - use the optional combinator (<|?>) instead. Returns a new permutation parser that includes p. <|?> (<|?>) :: Stream s Identity tok => StreamPermParser s st (a -> b) -> (a, Parsec s st a) -> StreamPermParser s st bStreamsIdentitytokStreamPermParsersstab(,)aParsecsstaStreamPermParsersstb.The expression perm <||> (x,p) adds parser p to the permutation parser perm. The parser p is optional - if it can not be applied, the default value x will be used instead. Returns a new permutation parser that includes the optional parser p. <|> (<|>) ::  Monad m => ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m aƫMonadmParsecTsumaParsecTsumaParsecTsumaThis combinator implements choice. The parser p <|> q first applies p. If it succeeds, the value of p is returned. If p fails without consuming any input, parser q is tried. This combinator is defined equal to the mplus member of the MonadPlus class and the (Control.Applicative.<|>) member of Control.Applicative.Alternative. The parser is called predictive since q is only tried when parser p didn't consume any input (i.e.. the look ahead is 1). This non-backtracking behaviour allows for both an efficient implementation of the parser combinators and the generation of good error messages.  () ::  Monad m => ParsecT s u m a -> String -> ParsecT s u m aLMonadmParsecTsumaStringParsecTsumaThe parser p ? msg behaves as parser p, but whenever the parser p fails without consuming any input, it replaces expect error messages with the expect error message msg. This is normally used at the end of a set alternatives where we want to return an error message in terms of a higher level construct rather than returning all possible characters. For example, if the expr parser from the try example would fail, the error message is: '...: expecting expression'. Without the (<?>) combinator, the message would be like '...: expecting "let" or letter', which is less friendly. <$?> (<$?>) :: Stream s Identity tok => (a -> b) -> (a, Parsec s st a) -> StreamPermParser s st bStreamsIdentitytokab(,)aParsecsstaStreamPermParsersstbUThe expression f <$?> (x,p) creates a fresh permutation parser consisting of parser p. The the final result of the permutation parser is the function f applied to the return value of p. The parser p is optional - if it can not be applied, the default value x will be used instead. <$$> (<$$>) :: Stream s Identity tok => (a -> b) ->  Parsec s st a -> StreamPermParser s st b]StreamsIdentitytokabParsecsstaStreamPermParsersstb1The expression f <$$> p creates a fresh permutation parser consisting of parser p. The the final result of the permutation parser is the function f applied to the return value of p. The parser p is not allowed to accept empty input - use the optional combinator (<$?>) instead. If the function f takes more than one parameter, the type variable b is instantiated to a functional type which combines nicely with the adds parser p to the (<||>) combinator. This results in stylized code where a permutation parser starts with a combining function f followed by the parsers. The function f gets its parameters in the order in which the parsers are specified, but actual input can be in any order. |class  Monad m => | (Stream s m t) (s -> t)ظAn instance of Stream has stream type s, underlying monad m and token type t determined by the stream Some rough guidelines for a "correct" instance of Stream:
  • unfoldM uncons gives the [t] corresponding to the stream
  • A Stream instance is responsible for maintaining the "position within the stream" in the stream state s. This is trivial unless you are using the monad in a non-trivial way.
 whiteSpace whiteSpace :: GenTokenParser s u m -> ParsecT s u m ()SGenTokenParsersumParsecTsum()#Parses any white space. White space consists of zero or more occurrences of a space, a line comment or a block (multi line) comment. Block comments may be nested. How comments are started and ended is defined in the LanguageDef that is passed to makeTokenParser. upperupper :: Stream s m Char => ParsecT s u m CharʼStreamsmCharParsecTsumChar]Parses an upper case letter (a character between 'A' and 'Z'). Returns the parsed character.  updateState updateState ::  Monad m => (u -> u) -> ParsecT s u m ()½MonadmuuParsecTsum()6An alias for modifyState for backwards compatibility. updatePosStringupdatePosString ::  SourcePos -> String ->  SourcePos SourcePosString SourcePosThe expression updatePosString pos s updates the source position pos by calling updatePosChar on every character in s, ie. foldl updatePosChar pos string.  updatePosChar updatePosChar ::  SourcePos -> Char ->  SourcePos  SourcePosChar SourcePosQUpdate a source position given a character. If the character is a newline ('\n') or carriage return ('\r') the line number is incremented by 1. If the character is a tab ('t') the column number is incremented to the nearest 8'th column, ie. column + 8 - ((column-1) `mod` 8). In all other cases, the column is incremented by 1. updateParserStateupdateParserState ::  Monad m => (State s u -> State s u) -> ParsecT s u m (State s u)?MonadmStatesuStatesuParsecTsumStatesuNupdateParserState f applies function f to the parser state.  unknownError unknownError ::  State s u ->  ParseErrorStatesu ParseError unexpected unexpected :: Stream s m t => String -> ParsecT s u m aqStreamsmtStringParsecTsumaThe parser unexpected msg always fails with an unexpected error message msg without consuming any input. The parsers fail, (<?>) and unexpected are the three parsers used to generate error messages. Of these, only (<?>) is commonly used. For an example of the use of unexpected, see the definition of Text.Parsec.Combinator.notFollowedBy. UnExpectUnExpect :: String -> MessageStringMessageunconsuncons :: Stream s m t => s -> m (Maybe (t, s))3StreamsmtsmMaybe(,)tstrytry :: Stream s m t => ParsecT s u m a -> ParsecT s u m aStreamsmtParsecTsumaParsecTsumaThe parser try p behaves like parser p, except that it pretends that it hasn't consumed any input when an error occurs. This combinator is used whenever arbitrary look ahead is needed. Since it pretends that it hasn't consumed any input when p fails, the (<|>) combinator will try its second alternative even when the first parser failed while consuming input. The try combinator can for example be used to distinguish identifiers and reserved words. Both reserved words and identifiers are a sequence of letters. Whenever we expect a certain reserved word where we can also expect an identifier we have to use the try combinator. Suppose we write:
expr        = letExpr <|> identifier <?> "expression"

letExpr     = do{ string "let"; ... }
identifier  = many1 letter
If the user writes "lexical", the parser fails with: unexpected 'x', expecting 't' in "let". Indeed, since the (<|>) combinator only tries alternatives when the first alternative hasn't consumed input, the identifier parser is never tried (because the prefix "le" of the string "let" parser is already consumed). The right behaviour can be obtained by adding the try combinator:
expr        = letExpr <|> identifier <?> "expression"

letExpr     = do{ try (string "let"); ... }
identifier  = many1 letter
tokens tokens :: (Stream s m t, Eq t) => ([t] -> String) -> (SourcePos -> [t] -> SourcePos) -> [t] -> ParsecT s u m [t]'StreamsmtEqt[]tString SourcePos[]t SourcePos[]tParsecTsum[]t tokenPrimEx  tokenPrimEx :: Stream s m t =>  (t -> String) -> "(SourcePos -> t -> s -> SourcePos) -> %Maybe (SourcePos -> t -> s -> u -> u) -> (t -> Maybe a) -> ParsecT s u m aStreamsmttString SourcePosts SourcePosMaybe SourcePostsuutMaybeaParsecTsuma tokenPrim  tokenPrim :: Stream s m t =>  (t -> String) -> "(SourcePos -> t -> s -> SourcePos) -> (t -> Maybe a) -> ParsecT s u m a7StreamsmttString SourcePosts SourcePostMaybeaParsecTsumaThe parser token showTok nextPos testTok accepts a token t with result x when the function testTok t returns Just x. The token can be shown using showTok t. The position of the next token should be returned when nextPos is called with the current source position pos, the current token t and the rest of the tokens toks, nextPos pos t toks. This is the most primitive combinator for accepting tokens. For example, the Text.Parsec.Char.char parser could be implemented as:
char c
  = tokenPrim showChar nextPos testChar
  where
    showChar x        = "'" ++ x ++ "'"
    testChar x        = if x == c then Just x else Nothing
    nextPos pos x xs  = updatePosChar pos x
 TokenParser> TokenParser :: ParsecT s u m String -> (String -> ParsecT s u m ()) -> ParsecT s u m String -> (String -> ParsecT s u m ()) -> ParsecT s u m Char -> ParsecT s u m String -> ParsecT s u m Integer -> ParsecT s u m Integer -> ParsecT s u m Double ->  %ParsecT s u m (Either Integer Double) ->  ParsecT s u m Integer ->  ParsecT s u m Integer ->  ParsecT s u m Integer ->  (String -> ParsecT s u m String) -> $(ParsecT s u m a -> ParsecT s u m a) -> ParsecT s u m () -> $(ParsecT s u m a -> ParsecT s u m a) -> $(ParsecT s u m a -> ParsecT s u m a) -> $(ParsecT s u m a -> ParsecT s u m a) -> $(ParsecT s u m a -> ParsecT s u m a) -> $(ParsecT s u m a -> ParsecT s u m a) -> ParsecT s u m String -> ParsecT s u m String -> ParsecT s u m String -> ParsecT s u m String -> &(ParsecT s u m a -> ParsecT s u m [a]) -> &(ParsecT s u m a -> ParsecT s u m [a]) -> &(ParsecT s u m a -> ParsecT s u m [a]) -> &(ParsecT s u m a -> ParsecT s u m [a]) -> GenTokenParser s u mjParsecTsumStringStringParsecTsum()ParsecTsumStringStringParsecTsum()ParsecTsumCharParsecTsumStringParsecTsumIntegerParsecTsumIntegerParsecTsumDoubleParsecTsumEitherIntegerDoubleParsecTsumIntegerParsecTsumIntegerParsecTsumIntegerStringParsecTsumStringParsecTsumaParsecTsumaParsecTsum()ParsecTsumaParsecTsumaParsecTsumaParsecTsumaParsecTsumaParsecTsumaParsecTsumaParsecTsumaParsecTsumaParsecTsumaParsecTsumStringParsecTsumStringParsecTsumStringParsecTsumStringParsecTsumaParsecTsum[]aParsecTsumaParsecTsum[]aParsecTsumaParsecTsum[]aParsecTsumaParsecTsum[]aGenTokenParsersum TokenParsertype  TokenParser st$ = GenTokenParser String st Identitytoken token :: Stream s Identity t =>  (t -> String) -> (t -> SourcePos) -> (t -> Maybe a) ->  Parsec s u anStreamsIdentityttStringt SourcePostMaybeaParsecsuaThe parser token showTok posFromTok testTok accepts a token t with result x when the function testTok t returns Just x. The source position of the t should be returned by posFromTok t and the token can be shown using showTok t. This combinator is expressed in terms of tokenPrim. It is used to accept user defined token streams. For example, suppose that we have a stream of basic tokens tupled with source positions. We can than define a parser that accepts single tokens as:
mytoken x
  = token showTok posFromTok testTok
  where
    showTok (pos,t)     = show t
    posFromTok (pos,t)  = pos
    testTok (pos,t)     = if x == t then Just t else Nothing
tabtab :: Stream s m Char => ParsecT s u m CharBStreamsmCharParsecTsumChar8Parses a tab character ('\t'). Returns a tab character. sysUnExpectErrorsysUnExpectError :: String ->  SourcePos ->  Reply s u aString SourcePosReplysua SysUnExpect SysUnExpect :: String -> MessagemStringMessagesymbolsymbol :: GenTokenParser s u m -> String -> ParsecT s u m String:GenTokenParsersumStringParsecTsumString`Lexeme parser symbol s parses string s and skips trailing white space.  stringLiteral stringLiteral :: GenTokenParser s u m -> ParsecT s u m StringG GenTokenParsersumParsecTsumStringThis lexeme parser parses a literal string. Returns the literal string value. This parsers deals correctly with escape sequences and gaps. The literal string is parsed according to the grammar rules defined in the Haskell report (which matches most programming languages quite closely). stringstring :: Stream s m Char => String -> ParsecT s u m String StreamsmCharStringParsecTsumStringstring s parses a sequence of characters given by s. Returns the parsed string (i.e. s).
divOrMod    =   string "div" 
            <|> string "mod"
StreamPermParserdata StreamPermParser s st aThe type StreamPermParser s st a denotes a permutation parser that, when converted by the permute function, parses s streams with user state st and returns a value of type a on success. Normally, a permutation parser is first build with special operators like (<||>) and than transformed into a normal parser using permute.  stateUser stateUser ::  State s u -> uStatesuustatePosstatePos ::  State s u ->  SourcePosqTStatesu SourcePos stateInput stateInput ::  State s u -> sStatesusState State :: s ->  SourcePos -> u ->  State s u_<s SourcePosuStatesuStatedata State s usquaressquares :: GenTokenParser s u m -> ParsecT s u m a -> ParsecT s u m aZGenTokenParsersumParsecTsumaParsecTsuma!DEPRECATED: Use brackets. spacesspaces :: Stream s m Char => ParsecT s u m ()StreamsmCharParsecTsum()LSkips zero or more white space characters. See also skipMany. spacespace :: Stream s m Char => ParsecT s u m CharStreamsmCharParsecTsumCharlParses a white space character (any character which satisfies isSpace) Returns the parsed character.  SourcePosdata  SourcePosqThe abstract data type SourcePos represents source positions. It contains the name of the source (i.e. file name), a line number and a column number. SourcePos is an instance of the Show, Eq and Ord class.  SourcePosdata  SourcePosThe abstract data type SourcePos represents source positions. It contains the name of the source (i.e. file name), a line number and a column number. SourcePos is an instance of the Show, Eq and Ord class.  sourceName sourceName ::  SourcePos ->  SourceName SourcePos SourceName8Extracts the name of the source from a source position.  sourceName sourceName ::  SourcePos ->  SourceName SourcePos SourceName8Extracts the name of the source from a source position.  SourceNametype  SourceName = String( SourceNametype  SourceName = Stringk sourceLine sourceLine ::  SourcePos -> Line SourcePosLine1Extracts the line number from a source position.  sourceLine sourceLine ::  SourcePos -> LinehT SourcePosLine1Extracts the line number from a source position.  sourceColumn sourceColumn ::  SourcePos -> Column SourcePosColumn3Extracts the column number from a source position.  sourceColumn sourceColumn ::  SourcePos -> Column SourcePosColumn3Extracts the column number from a source position.  skipMany1 skipMany1 :: Stream s m t => ParsecT s u m a -> ParsecT s u m ()MStreamsmtParsecTsumaParsecTsum()bskipMany1 p applies the parser p one or more times, skipping its result. skipManyskipMany :: Stream s m t => ParsecT s u m a -> ParsecT s u m ()dStreamsmtParsecTsumaParsecTsum()skipMany p applies the parser p zero or more times, skipping its result.
spaces  = skipMany space
showErrorMessagesshowErrorMessages :: String -> String -> String -> String -> String ->  [Message] -> String0StringStringStringStringString[]MessageStringsetStatesetState ::  Monad m => u -> ParsecT s u m ()MonadmuParsecTsum()3An alias for putState for backwards compatibility.  setSourceName setSourceName ::  SourcePos ->  SourceName ->  SourcePos] SourcePos SourceName SourcePosSet the name of the source.  setSourceName setSourceName ::  SourcePos ->  SourceName ->  SourcePos6 SourcePos SourceName SourcePosSet the name of the source.  setSourceLine setSourceLine ::  SourcePos -> Line ->  SourcePos SourcePosLine SourcePos*Set the line number of a source position.  setSourceLine setSourceLine ::  SourcePos -> Line ->  SourcePosu SourcePosLine SourcePos*Set the line number of a source position. setSourceColumnsetSourceColumn ::  SourcePos -> Column ->  SourcePosR1 SourcePosColumn SourcePos,Set the column number of a source position. setSourceColumnsetSourceColumn ::  SourcePos -> Column ->  SourcePos SourcePosColumn SourcePos,Set the column number of a source position.  setPosition setPosition ::  Monad m =>  SourcePos -> ParsecT s u m ()Monadm SourcePosParsecTsum()KsetPosition pos sets the current source position to pos. setParserStatesetParserState ::  Monad m =>  State s u -> ParsecT s u m (State s u)MonadmStatesuParsecTsumStatesuEsetParserState st set the full parser state to st. setInputsetInput ::  Monad m => s -> ParsecT s u m ()MonadmsParsecTsum()setInput input continues parsing with input. The getInput and setInput functions can for example be used to deal with #include files.  setErrorPos setErrorPos ::  SourcePos ->  ParseError ->  ParseError SourcePos ParseError ParseErrorsetErrorMessagesetErrorMessage :: Message ->  ParseError ->  ParseErroraMessage ParseError ParseError sepEndBy1 sepEndBy1 :: Stream s m t => ParsecT s u m a -> ParsecT s u m sep -> ParsecT s u m [a]xStreamsmtParsecTsumaParsecTsumsepParsecTsum[]asepEndBy1 p sep parses one or more occurrences of p, separated and optionally ended by sep. Returns a list of values returned by p. sepEndBysepEndBy :: Stream s m t => ParsecT s u m a -> ParsecT s u m sep -> ParsecT s u m [a]StreamsmtParsecTsumaParsecTsumsepParsecTsum[]asepEndBy p sep parses zero or more occurrences of p, separated and optionally ended by sep, ie. haskell style statements. Returns a list of values returned by p.
haskellStatements  = haskellStatement `sepEndBy` semi
sepBy1sepBy1 :: Stream s m t => ParsecT s u m a -> ParsecT s u m sep -> ParsecT s u m [a]StreamsmtParsecTsumaParsecTsumsepParsecTsum[]asepBy1 p sep parses one or more occurrences of p, separated by sep. Returns a list of values returned by p. sepBysepBy :: Stream s m t => ParsecT s u m a -> ParsecT s u m sep -> ParsecT s u m [a]5StreamsmtParsecTsumaParsecTsumsepParsecTsum[]asepBy p sep parses zero or more occurrences of p, separated by sep. Returns a list of values returned by p.
commaSep p  = p `sepBy` (symbol ",")
semiSep1semiSep1 :: GenTokenParser s u m -> ParsecT s u m a -> ParsecT s u m [a]5GenTokenParsersumParsecTsumaParsecTsum[]aLexeme parser semiSep1 p parses one or more occurrences of p separated by semi. Returns a list of values returned by p. semiSepsemiSep :: GenTokenParser s u m -> ParsecT s u m a -> ParsecT s u m [a] U GenTokenParsersumParsecTsumaParsecTsum[]aLexeme parser semiSep p parses zero or more occurrences of p separated by semi. Returns a list of values returned by p. semisemi :: GenTokenParser s u m -> ParsecT s u m String  GenTokenParsersumParsecTsumStringjLexeme parser |semi| parses the character ';' and skips any trailing white space. Returns the string ";". satisfysatisfy :: Stream s m Char => (Char -> Bool) -> ParsecT s u m Char  StreamsmCharCharBoolParsecTsumCharThe parser satisfy f succeeds for any character for which the supplied function f returns True. Returns the character that is actually parsed. runPT runPT :: Stream s m t => ParsecT s u m a -> u ->  SourceName -> s -> m (Either ParseError a) I StreamsmtParsecTsumau SourceNamesmEither ParseErrora runParserT  runParserT :: Stream s m t => ParsecT s u m a -> u ->  SourceName -> s -> m (Either ParseError a)QStreamsmtParsecTsumau SourceNamesmEither ParseErroraThe most general way to run a parser. runParserT p state filePath input runs parser p on the input list of tokens input, obtained from source filePath with the initial user state st. The filePath is only used in error messages and may be the empty string. Returns a computation in the underlying monad m that return either a ParseError (Left) or a value of type a (Right).  runParser  runParser :: Stream s Identity t =>  Parsec s u a -> u ->  SourceName -> s -> Either ParseError a)StreamsIdentitytParsecsuau SourceNamesEither ParseErrora'The most general way to run a parser over the Identity monad. runParser p state filePath input runs parser p on the input list of tokens input, obtained from source filePath with the initial user state st. The filePath is only used in error messages and may be the empty string. Returns either a ParseError (Left) or a value of type a (Right).
parseFromFile p fname
  = do{ input <- readFile fname
      ; return (runParser p () fname input)
      }
 runParsecT runParsecT :: ParsecT s u m a ->  State s u -> m (Consumed (m (Reply s u a)))2ParsecTsumaStatesumConsumedmReplysuarunP runP :: Stream s Identity t =>  Parsec s u a -> u ->  SourceName -> s -> Either ParseError a}"StreamsIdentitytParsecsuau SourceNamesEither ParseErrorareservedOpNamesreservedOpNames :: GenLanguageDef s u m -> [String]GenLanguageDefsum[]String The list of reserved operators.  reservedOp reservedOp :: GenTokenParser s u m -> String -> ParsecT s u m ()GenTokenParsersumStringParsecTsum()The lexeme parser reservedOp name parses symbol name, but it also checks that the name is not a prefix of a valid operator. A reservedOp is treated as a single token using try.  reservedNames reservedNames :: GenLanguageDef s u m -> [String]\0GenLanguageDefsum[]String"The list of reserved identifiers. reservedreserved :: GenTokenParser s u m -> String -> ParsecT s u m ()3GenTokenParsersumStringParsecTsum()The lexeme parser reserved name parses symbol name, but it also checks that the name is not a prefix of a valid identifier. A reserved word is treated as a single token using try. Replydata Reply s u aFputStateputState ::  Monad m => u -> ParsecT s u m ()MonadmuParsecTsum()8putState st set the user state to st. PrefixPrefix :: ParsecT s u m (a -> a) -> Operator s u m ahParsecTsumaaOperatorsumaPostfixPostfix :: ParsecT s u m (a -> a) -> Operator s u m a;ParsecTsumaaOperatorsumapermutepermute :: Stream s Identity tok => StreamPermParser s st a ->  Parsec s st aStreamsIdentitytokStreamPermParsersstaParsecsstaThe parser permute perm parses a permutation of parser described by perm. For example, suppose we want to parse a permutation of: an optional string of a's, the character b and an optional c. This can be described by:
test  = permute (tuple <$?> ("",many1 (char 'a'))
                       <||> char 'b' 
                       <|?> ('_',char 'c'))
      where
        tuple a b c  = (a,b,c)
 PermParsertype  PermParser tok st a = StreamPermParser String st a@?Provided for backwards compatibility. The tok type is ignored.  parseTest parseTest :: !(Stream s Identity t, Show a) =>  Parsec s () a -> s -> IO ()K  StreamsIdentitytShowaParsecs()asIO()The expression parseTest p input applies a parser p against input input and prints the result to stdout. Used for testing parsers.  parserZero parserZero ::  Monad m => ParsecT s u m a`!parserZero always fails without consuming any input. parserZero is defined equal to the mzero member of the MonadPlus class and to the Control.Applicative.empty member of the Control.Applicative.Applicative class.  parserReturn parserReturn ::  Monad m => a -> ParsecT s u m a""MonadmaParsecTsuma parserPlus parserPlus ::  Monad m => ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a#l#MonadmParsecTsumaParsecTsumaParsecTsuma parserFail parserFail ::  Monad m => String -> ParsecT s u m aS$%$MonadmStringParsecTsuma parserBind parserBind ::  Monad m => ParsecT s u m a -> (a -> ParsecT s u m b) -> ParsecT s u m b<%$MonadmParsecTsumaaParsecTsumbParsecTsumb Parsertype Parser = Parsec String ()% Parsertype Parser = Parsec ByteString ()% parseFromFile parseFromFile :: Parser a -> String -> IO (Either ParseError a)~&G&ParseraStringIOEither ParseErroraparseFromFile p filePath runs a string parser p on the input read from filePath using readFile. Returns either a ParseError (Left) or a value of type a (Right).
main    = do{ result <- parseFromFile numbers "digits.txt"
            ; case result of
                Left err  -> print err
                Right xs  -> print (sum xs)
            }
 parseFromFile parseFromFile :: Parser a -> String -> IO (Either ParseError a)((ParseraStringIOEither ParseErroraparseFromFile p filePath runs a strict bytestring parser p on the input read from filePath using ByteString.Char8.readFile. Returns either a ParseError (Left) or a value of type a (Right).
main    = do{ result <- parseFromFile numbers "digits.txt"
            ; case result of
                Left err  -> print err
                Right xs  -> print (sum xs)
            }
 ParseErrordata  ParseError*>The abstract data type ParseError represents parse errors. It provides the source position (SourcePos) of the error and a list of error messages (Message). A ParseError can be returned by the function Text.Parsec.Prim.parse. ParseError is an instance of the Show class.  ParseErrordata  ParseErrorW,>The abstract data type ParseError represents parse errors. It provides the source position (SourcePos) of the error and a list of error messages (Message). A ParseError can be returned by the function Text.Parsec.Prim.parse. ParseError is an instance of the Show class. ParsecTParsecT :: -(State s u -> m (Consumed (m (Reply s u a)))) -> ParsecT s u m ac..StatesumConsumedmReplysuaParsecTsumaParsecTdata ParsecT s u m a.ParserT monad transformer and Parser type ParsecT s u m a is a parser with stream type s, user state type u, underlying monad m and return type a  parsecMap parsecMap ::  Monad m => (a -> b) -> ParsecT s u m a -> ParsecT s u m b"0/MonadmabParsecTsumaParsecTsumbParsectype Parsec s u = ParsecT s u Identityo0parse parse :: Stream s Identity t =>  Parsec s () a ->  SourceName -> s -> Either ParseError a]11StreamsIdentitytParsecs()a SourceNamesEither ParseErroraparse p filePath input runs a parser p over Identity without user state. The filePath is only used in error messages and may be the empty string. Returns either a ParseError (Left) or a value of type a (Right).
main    = case (parse numbers "" "11, 2, 43") of
           Left err  -> print err
           Right xs  -> print (sum xs)

numbers = commaSep integer
parensparens :: GenTokenParser s u m -> ParsecT s u m a -> ParsecT s u m a33GenTokenParsersumParsecTsumaParsecTsumanLexeme parser parens p parses p enclosed in parenthesis, returning the value of p.  optionMaybe optionMaybe :: Stream s m t => ParsecT s u m a -> ParsecT s u m (Maybe a)54StreamsmtParsecTsumaParsecTsumMaybeaoption p tries to apply parser p. If p fails without consuming input, it return Nothing, otherwise it returns Just the value returned by p. optionaloptional :: Stream s m t => ParsecT s u m a -> ParsecT s u m ()6@6StreamsmtParsecTsumaParsecTsum()optional p tries to apply parser p. It will parse p or nothing. It only fails if p fails after consuming input. It discards the result of p. optionoption :: Stream s m t => a -> ParsecT s u m a -> ParsecT s u m a77StreamsmtaParsecTsumaParsecTsuma2option x p tries to apply parser p. If p fails without consuming input, it returns the value x, otherwise the value returned by p.
priority  = option 0 (do{ d <- digit
                        ; return (digitToInt d) 
                        })
opStartopStart :: GenLanguageDef s u m -> ParsecT s u m Char99GenLanguageDefsumParsecTsumCharzThis parser should accept any start characters of operators. For example oneOf ":!#$%&*+./<=>?@\\^|-~" opLetteropLetter :: GenLanguageDef s u m -> ParsecT s u m Char::GenLanguageDefsumParsecTsumCharThis parser should accept any legal tail characters of operators. Note that this parser should even be defined if the language doesn't support user-defined operators, or otherwise the reservedOp parser won't work correctly.  OperatorTabletype  OperatorTable s u m a = [[Operator s u m a]],<An OperatorTable s u m a is a list of Operator s u m a lists. The list is ordered in descending precedence. All operators in one list have the same precedence (but may have a different associativity). operatoroperator :: GenTokenParser s u m -> ParsecT s u m String=p=GenTokenParsersumParsecTsumString_This lexeme parser parses a legal operator. Returns the name of the operator. This parser will fail on any operators that are reserved operators. Legal operator (start) characters and reserved operators are defined in the LanguageDef that is passed to makeTokenParser. An operator is treated as a single token using try. Operatordata Operator s u m aE?This data type specifies operators that work on values of type a. An operator is either binary infix or unary prefix or postfix. A binary operator has also an associated associativity. oneOfoneOf :: Stream s m Char => [Char] -> ParsecT s u m Char@m@StreamsmChar[]CharParsecTsumCharoneOf cs succeeds if the current character is in the supplied list of characters cs. Returns the parsed character. See also satisfy.
vowel  = oneOf "aeiou"
Ok Ok :: a ->  State s u ->  ParseError ->  Reply s u aBAaStatesu ParseErrorReplysuaoctDigitoctDigit :: Stream s m Char => ParsecT s u m CharBhBStreamsmCharParsecTsumCharWParses an octal digit (a character between '0' and '7'). Returns the parsed character. octaloctal :: GenTokenParser s u m -> ParsecT s u m IntegerCTCGenTokenParsersumParsecTsumIntegerParses a positive whole number in the octal system. The number should be prefixed with "0o" or "0O". Returns the value of the number.  notFollowedBy notFollowedBy :: (Stream s m t, Show t) => ParsecT s u m t -> ParsecT s u m ()DDStreamsmtShowtParsecTsumtParsecTsum()7notFollowedBy p only succeeds when parser p fails. This parser does not consume any input. This parser can be used to implement the 'longest match' rule. For example, when recognizing keywords (for example let), we want to make sure that a keyword is not followed by a legal identifier character, in which case the keyword is actually an identifier (for example lets). We can program this behaviour as follows:
keywordLet  = try (do{ string "let"
                     ; notFollowedBy alphaNum
                     })
noneOfnoneOf :: Stream s m Char => [Char] -> ParsecT s u m CharGGStreamsmChar[]CharParsecTsumCharAs the dual of oneOf, noneOf cs succeeds if the current character not in the supplied list of characters cs. Returns the parsed character.
consonant = noneOf "aeiou"
newPos newPos ::  SourceName -> Line -> Column ->  SourcePos5I I SourceNameLineColumn SourcePosYCreate a new SourcePos with the given source name, line number and column number. newlinenewline :: Stream s m Char => ParsecT s u m CharJIStreamsmCharParsecTsumChar@Parses a newline character ('\n'). Returns a newline character. newErrorUnknownnewErrorUnknown ::  SourcePos ->  ParseErrorJJ SourcePos ParseErrornewErrorMessagenewErrorMessage :: Message ->  SourcePos ->  ParseErrorkKHKMessage SourcePos ParseErrornestedCommentsnestedComments :: GenLanguageDef s u m -> BoolKKGenLanguageDefsumBoolCSet to True if the language supports nested block comments. naturalOrFloatnaturalOrFloat :: GenTokenParser s u m -> %ParsecT s u m (Either Integer Double) MLGenTokenParsersumParsecTsumEitherIntegerDouble This lexeme parser parses either natural or a float. Returns the value of the number. This parsers deals with any overlap in the grammar rules for naturals and floats. The number is parsed according to the grammar rules defined in the Haskell report. naturalnatural :: GenTokenParser s u m -> ParsecT s u m IntegerN{NGenTokenParsersumParsecTsumIntegerThis lexeme parser parses a natural number (a positive whole number). Returns the value of the number. The number can be specified in decimal, hexadecimal or octal. The number is parsed according to the grammar rules in the Haskell report.  mondrianDef mondrianDef :: LanguageDef stPP LanguageDefst3The language definition for the language Mondrian. mondrianmondrian :: TokenParser stPP TokenParserst#A lexer for the mondrian language.  modifyState modifyState ::  Monad m => (u -> u) -> ParsecT s u m ()^Q/QMonadmuuParsecTsum() updateState f applies function f to the user state. Suppose that we want to count identifiers in a source, we could use the user state as:
expr  = do{ x <- identifier
          ; updateState (+1)
          ; return (Id x)
          }
 messageString messageString :: Message -> StringRRMessageString1Extract the message string from an error message MessageMessage :: String -> MessagehSTSStringMessageMessagedata MessageSThis abstract data type represents parse error messages. There are four kinds of messages:
data Message = SysUnExpect String
             | UnExpect String
             | Expect String
             | Message String
The fine distinction between different kinds of parse errors allows the system to generate quite good error messages for the user. It also allows error messages that are formatted in different languages. Each kind of message is generated by different combinators:
  • A SysUnExpect message is automatically generated by the Text.Parsec.Combinator.satisfy combinator. The argument is the unexpected input.
  • A UnExpect message is generated by the Text.Parsec.Prim.unexpected combinator. The argument describes the unexpected item.
  • A Expect message is generated by the Text.Parsec.Prim.<?> combinator. The argument describes the expected item.
  • A Message message is generated by the fail combinator. The argument is some general parser message.
mergeErrorReplymergeErrorReply ::  ParseError ->  Reply s u a ->  Reply s u agX4X ParseErrorReplysuaReplysua mergeError mergeError ::  ParseError ->  ParseError ->  ParseErrorXX ParseError ParseError ParseErrormanyTillmanyTill :: Stream s m t => ParsecT s u m a -> ParsecT s u m end -> ParsecT s u m [a]YYStreamsmtParsecTsumaParsecTsumendParsecTsum[]amanyTill p end applies parser p zero or more times until parser end succeeds. Returns the list of values returned by p. This parser can be used to scan comments:
simpleComment   = do{ string "<!--"
                    ; manyTill anyChar (try (string "-->"))
                    }
Note the overlapping parsers anyChar and string "<!--", and therefore the use of the try combinator.  manyAccum manyAccum :: Stream s m t => (a -> [a] -> [a]) -> ParsecT s u m a -> ParsecT s u m [a]\W\Streamsmta[]a[]aParsecTsumaParsecTsum[]amany1many1 :: Stream s m t => ParsecT s u m a -> ParsecT s u m [a]m]#]StreamsmtParsecTsumaParsecTsum[]amany p applies the parser p one or more times. Returns a list of the returned values of p.
word  = many1 letter
manymany :: Stream s m t => ParsecT s u m a -> ParsecT s u m [a]^v^StreamsmtParsecTsumaParsecTsum[]amany p applies the parser p zero or more times. Returns a list of the returned values of p.
identifier  = do{ c  <- letter
                ; cs <- many (alphaNum <|> char '_')
                ; return (c:cs)
                }
makeTokenParsermakeTokenParser :: Stream s m Char => GenLanguageDef s u m -> GenTokenParser s u m`h`StreamsmCharGenLanguageDefsumGenTokenParsersumThe expression makeTokenParser language creates a GenTokenParser record that contains lexical parsers that are defined using the definitions in the language record. The use of this function is quite stylized - one imports the appropiate language definition and selects the lexical parsers that are needed from the resulting GenTokenParser.
module Main where

import Text.Parsec
import qualified Text.Parsec.Token as P
import Text.Parsec.Language (haskellDef)

-- The parser
...

expr  =   parens expr
      <|> identifier
      <|> ...
     

-- The lexer
lexer       = P.makeTokenParser haskellDef    
    
parens      = P.parens lexer
braces      = P.braces lexer
identifier  = P.identifier lexer
reserved    = P.reserved lexer
...
lowerlower :: Stream s m Char => ParsecT s u m CharUd$dStreamsmCharParsecTsumChar_Parses a lower case character (a character between 'a' and 'z'). Returns the parsed character.  lookAhead lookAhead :: Stream s m t => ParsecT s u m a -> ParsecT s u m aie%eStreamsmtParsecTsumaParsecTsumaDlookAhead p parses p without consuming any input. Linetype Line = InteLinetype Line = Intflexemelexeme :: GenTokenParser s u m -> ParsecT s u m a -> ParsecT s u m affGenTokenParsersumParsecTsumaParsecTsumalexeme p first applies parser p and than the whiteSpace parser, returning the value of p. Every lexical token (lexeme) is defined using lexeme, this way every parse starts at a point without white space. Parsers that use lexeme are called lexeme parsers in this document. The only point where the whiteSpace parser should be called explicitly is the start of the main parser in order to skip any leading white space.
mainParser  = do{ whiteSpace
                 ; ds <- many (lexeme digit)
                 ; eof
                 ; return (sum ds)
                 }
letterletter :: Stream s m Char => ParsecT s u m ChariiStreamsmCharParsecTsumCharWParses a letter (an upper case or lower case character). Returns the parsed character.  LanguageDef LanguageDef :: String -> String -> String -> Bool -> ParsecT s u m Char -> ParsecT s u m Char -> ParsecT s u m Char -> ParsecT s u m Char -> [String] ->  [String] ->  Bool -> GenLanguageDef s u mQlk StringStringStringBoolParsecTsumCharParsecTsumCharParsecTsumCharParsecTsumChar[]String[]StringBoolGenLanguageDefsum LanguageDeftype  LanguageDef st$ = GenLanguageDef String st Identityl LanguageDeftype  LanguageDef st$ = GenLanguageDef String st Identitymlabelslabels ::  Monad m => ParsecT s u m a -> [String] -> ParsecT s u m ammMonadmParsecTsuma[]StringParsecTsumalabellabel ::  Monad m => ParsecT s u m a -> String -> ParsecT s u m anRnMonadmParsecTsumaStringParsecTsuma javaStyle javaStyle :: LanguageDef stnn LanguageDefstThis is a minimal token definition for Java style languages. It defines the style of comments, valid identifiers and case sensitivity. It does not define any reserved words or operators. integerinteger :: GenTokenParser s u m -> ParsecT s u m IntegerNppGenTokenParsersumParsecTsumIntegerUThis lexeme parser parses an integer (a whole number). This parser is like natural except that it can be prefixed with sign (i.e. '-' or '+'). Returns the value of the number. The number can be specified in decimal, hexadecimal or octal. The number is parsed according to the grammar rules in the Haskell report.  initialPos initialPos ::  SourceName ->  SourcePosrq SourceName SourcePosvCreate a new SourcePos with the given source name, and line number and column number set to 1, the upper left. InfixInfix :: ParsecT s u m (a -> a -> a) -> Assoc -> Operator s u m aCssParsecTsumaaaAssocOperatorsuma incSourceLine incSourceLine ::  SourcePos -> Line ->  SourcePosss SourcePosLine SourcePos1Increments the line number of a source position.  incSourceLine incSourceLine ::  SourcePos -> Line ->  SourcePostmt SourcePosLine SourcePos1Increments the line number of a source position. incSourceColumnincSourceColumn ::  SourcePos -> Column ->  SourcePosQu0u SourcePosColumn SourcePos3Increments the column number of a source position. incSourceColumnincSourceColumn ::  SourcePos -> Column ->  SourcePosvu SourcePosColumn SourcePos3Increments the column number of a source position.  identStart identStart :: GenLanguageDef s u m -> ParsecT s u m CharvvGenLanguageDefsumParsecTsumCharoThis parser should accept any start characters of identifiers. For example letter <|> char "_".  identLetter identLetter :: GenLanguageDef s u m -> ParsecT s u m CharxwGenLanguageDefsumParsecTsumCharvThis parser should accept any legal tail characters of identifiers. For example alphaNum <|> char "_".  identifier identifier :: GenTokenParser s u m -> ParsecT s u m StringyxGenTokenParsersumParsecTsumStringXThis lexeme parser parses a legal identifier. Returns the identifier string. This parser will fail on identifiers that are reserved words. Legal identifier (start) characters and reserved words are defined in the LanguageDef that is passed to makeTokenParser. An identifier is treated as a single token using try. hexDigithexDigit :: Stream s m Char => ParsecT s u m Char{zStreamsmCharParsecTsumCharsParses a hexadecimal digit (a digit or a letter between 'a' and 'f' or 'A' and 'F'). Returns the parsed character.  hexadecimal hexadecimal :: GenTokenParser s u m -> ParsecT s u m Integer |{GenTokenParsersumParsecTsumIntegerParses a positive whole number in the hexadecimal system. The number should be prefixed with "0x" or "0X". Returns the value of the number.  haskellStyle haskellStyle :: LanguageDef st }| LanguageDefstThis is a minimal token definition for Haskell style languages. It defines the style of comments, valid identifiers and case sensitivity. It does not define any reserved words or operators.  haskellDef haskellDef :: LanguageDef st$~~ LanguageDefst2The language definition for the Haskell language. haskellhaskell :: TokenParser st~~ TokenParserst"A lexer for the haskell language. getStategetState ::  Monad m => ParsecT s u m u@MonadmParsecTsumu Returns the current user state.  getPosition getPosition ::  Monad m => ParsecT s u m SourcePosMonadmParsecTsum SourcePos@Returns the current source position. See also SourcePos. getParserStategetParserState ::  Monad m => ParsecT s u m (State s u)MonadmParsecTsumStatesu8Returns the full parser state as a State record. getInputgetInput ::  Monad m => ParsecT s u m siEMonadmParsecTsumsReturns the current input GenTokenParserdata GenTokenParser s u mɁThe type of the record that holds lexical parsers that work on s streams with state u over a monad m.  GenParsertype  GenParser tok st = Parsec [tok] st GenParsertype  GenParser t st = Parsec ByteString stGenLanguageDefdata GenLanguageDef s u m5The GenLanguageDef type is a record that contains all parameterizable features of the Text.Parsec.Token module. The module Text.Parsec.Language contains some default definitions. GenLanguageDefdata GenLanguageDef s u m7The GenLanguageDef type is a record that contains all parameterizable features of the Text.Parsec.Token module. The module Text.Parsec.Language contains some default definitions. floatfloat :: GenTokenParser s u m -> ParsecT s u m DoubleVGenTokenParsersumParsecTsumDoubleThis lexeme parser parses a floating point value. Returns the value of the number. The number is parsed according to the grammar rules defined in the Haskell report. ExpectExpect :: String -> MessageStringMessageerrorPoserrorPos ::  ParseError ->  SourcePos ParseError SourcePos2Extracts the source position from the parse error errorPoserrorPos ::  ParseError ->  SourcePos ParseError SourcePos2Extracts the source position from the parse error  errorMessages errorMessages ::  ParseError ->  [Message]P2 ParseError[]Message9Extracts the list of error messages from the parse error errorIsUnknownerrorIsUnknown ::  ParseError -> Bool ParseErrorBoolErrorError ::  ParseError ->  Reply s u ajI ParseErrorReplysuaeofeof :: (Stream s m t, Show t) => ParsecT s u m ()StreamsmtShowtParsecTsum()This parser only succeeds at the end of the input. This is not a primitive parser but it is defined using notFollowedBy.
eof  = notFollowedBy anyToken <?> "end of input"
endBy1endBy1 :: Stream s m t => ParsecT s u m a -> ParsecT s u m sep -> ParsecT s u m [a]EStreamsmtParsecTsumaParsecTsumsepParsecTsum[]aendBy1 p sep parses one or more occurrences of p, seperated and ended by sep. Returns a list of values returned by p. endByendBy :: Stream s m t => ParsecT s u m a -> ParsecT s u m sep -> ParsecT s u m [a]4ьStreamsmtParsecTsumaParsecTsumsepParsecTsum[]aendBy p sep parses zero or more occurrences of p, seperated and ended by sep. Returns a list of values returned by p.
cStatements  = cStatement `endBy` semi
emptyDefemptyDef :: LanguageDef staM LanguageDefstEmptyEmpty :: a ->  Consumed aaConsumedadotdot :: GenTokenParser s u m -> ParsecT s u m StringUGenTokenParsersumParsecTsumStringpLexeme parser dot parses the character '.' and skips any trailing white space. Returns the string ".". digitdigit :: Stream s m Char => ParsecT s u m CharJStreamsmCharParsecTsumChar.Parses a digit. Returns the parsed character. decimaldecimal :: GenTokenParser s u m -> ParsecT s u m IntegerGenTokenParsersumParsecTsumIntegerWParses a positive whole number in the decimal system. Returns the value of the number. countcount :: Stream s m t => Int -> ParsecT s u m a -> ParsecT s u m [a];StreamsmtIntParsecTsumaParsecTsum[]acount n p parses n occurrences of p. If n is smaller or equal to zero, the parser equals to return []. Returns a list of n values returned by p. ConsumedConsumed :: a ->  Consumed alWaConsumedaConsumeddata Consumed a commentStart commentStart :: GenLanguageDef s u m -> String+GenLanguageDefsumStringDescribes the start of a block comment. Use the empty string if the language doesn't support block comments. For example "/*".  commentLine commentLine :: GenLanguageDef s u m -> String1 GenLanguageDefsumString}Describes the start of a line comment. Use the empty string if the language doesn't support line comments. For example "//".  commentEnd commentEnd :: GenLanguageDef s u m -> String3 GenLanguageDefsumString}Describes the end of a block comment. Use the empty string if the language doesn't support block comments. For example "*/".  commaSep1 commaSep1 :: GenTokenParser s u m -> ParsecT s u m a -> ParsecT s u m [a]3GenTokenParsersumParsecTsumaParsecTsum[]aLexeme parser commaSep1 p parses one or more occurrences of p separated by comma. Returns a list of values returned by p. commaSepcommaSep :: GenTokenParser s u m -> ParsecT s u m a -> ParsecT s u m [a]GenTokenParsersumParsecTsumaParsecTsum[]aLexeme parser commaSep p parses zero or more occurrences of p separated by comma. Returns a list of values returned by p. commacomma :: GenTokenParser s u m -> ParsecT s u m String;GenTokenParsersumParsecTsumStringrLexeme parser comma parses the character ',' and skips any trailing white space. Returns the string ",". Columntype Column = IntColumntype Column = Intcoloncolon :: GenTokenParser s u m -> ParsecT s u m StringGenTokenParsersumParsecTsumStringrLexeme parser colon parses the character ':' and skips any trailing white space. Returns the string ":". choicechoice :: Stream s m t => [ParsecT s u m a] -> ParsecT s u m aStreamsmt[]ParsecTsumaParsecTsumachoice ps tries to apply the parsers in the list ps in order, until one of them succeeds. Returns the value of the succeeding parser.  charLiteral charLiteral :: GenTokenParser s u m -> ParsecT s u m Char GenTokenParsersumParsecTsumChar&This lexeme parser parses a single literal character. Returns the literal character value. This parsers deals correctly with escape sequences. The literal character is parsed according to the grammar rules defined in the Haskell report (which matches most programming languages quite closely). charchar :: Stream s m Char => Char -> ParsecT s u m CharStreamsmCharCharParsecTsumCharchar c parses a single character c. Returns the parsed character (i.e. c).
semiColon  = char ';'
chainr1chainr1 :: Stream s m t => ParsecT s u m a -> ParsecT s u m (a -> a -> a) -> ParsecT s u m abStreamsmtParsecTsumaParsecTsumaaaParsecTsumachainr1 p op x parser one or more occurrences of |p|, separated by op Returns a value obtained by a right associative application of all functions returned by op to the values returned by p. chainr chainr :: Stream s m t => ParsecT s u m a -> ParsecT s u m (a -> a -> a) -> a -> ParsecT s u m aXStreamsmtParsecTsumaParsecTsumaaaaParsecTsumaEchainr p op x parser zero or more occurrences of p, separated by op Returns a value obtained by a right associative application of all functions returned by op to the values returned by p. If there are no occurrences of p, the value x is returned. chainl1chainl1 :: Stream s m t => ParsecT s u m a -> ParsecT s u m (a -> a -> a) -> ParsecT s u m a1StreamsmtParsecTsumaParsecTsumaaaParsecTsumachainl1 p op x parser one or more occurrences of p, separated by op Returns a value obtained by a left associative application of all functions returned by op to the values returned by p. . This parser can for example be used to eliminate left recursion which typically occurs in expression grammars.
expr    = term   `chainl1` mulop
term    = factor `chainl1` addop
factor  = parens expr <|> integer

mulop   =   do{ symbol "*"; return (*)   }
        <|> do{ symbol "/"; return (div) }

addop   =   do{ symbol "+"; return (+) }
        <|> do{ symbol "-"; return (-) }
chainl chainl :: Stream s m t => ParsecT s u m a -> ParsecT s u m (a -> a -> a) -> a -> ParsecT s u m a/ɨStreamsmtParsecTsumaParsecTsumaaaaParsecTsumaGchainl p op x parser zero or more occurrences of p, separated by op. Returns a value obtained by a left associative application of all functions returned by op to the values returned by p. If there are zero occurrences of p, the value x is returned.  caseSensitive caseSensitive :: GenLanguageDef s u m -> Bool٪GenLanguageDefsumBool6Set to True if the language is case sensitive. buildExpressionParserbuildExpressionParser :: Stream s m t => OperatorTable s u m a -> ParsecT s u m a -> ParsecT s u m a>ݫStreamsmt OperatorTablesumaParsecTsumaParsecTsumaYbuildExpressionParser table term builds an expression parser for terms term with operators from table, taking the associativity and precedence specified in table into account. Prefix and postfix operators of the same precedence can only occur once (i.e. --2 is not allowed if - is prefix negate). Prefix and postfix operators of the same precedence associate to the left (i.e. if ++ is postfix increment, than -2++ equals -1, not -3). The buildExpressionParser takes care of all the complexity involved in building expression parser. Here is an example of an expression parser that handles prefix signs, postfix increment and basic arithmetic.
expr    = buildExpressionParser table term
        <?> "expression"

term    =  parens expr 
        <|> natural
        <?> "simple expression"

table   = [ [prefix "-" negate, prefix "+" id ]
          , [postfix "++" (+1)]
          , [binary "*" (*) AssocLeft, binary "/" (div) AssocLeft ]
          , [binary "+" (+) AssocLeft, binary "-" (-)   AssocLeft ]
          ]
        
binary  name fun assoc = Infix (do{ reservedOp name; return fun }) assoc
prefix  name fun       = Prefix (do{ reservedOp name; return fun })
postfix name fun       = Postfix (do{ reservedOp name; return fun })
bracketsbrackets :: GenTokenParser s u m -> ParsecT s u m a -> ParsecT s u m abGenTokenParsersumParsecTsumaParsecTsuma{Lexeme parser brackets p parses p enclosed in brackets ('[' and ']'), returning the value of p. bracesbraces :: GenTokenParser s u m -> ParsecT s u m a -> ParsecT s u m aXGenTokenParsersumParsecTsumaParsecTsumawLexeme parser braces p parses p enclosed in braces ('{' and '}'), returning the value of p. between between :: Stream s m t => ParsecT s u m open -> ParsecT s u m close -> ParsecT s u m a -> ParsecT s u m a>ŴStreamsmtParsecTsumopenParsecTsumcloseParsecTsumaParsecTsumabetween open close p parses open, followed by p and close. Returns the value returned by p.
braces  = between (symbol "{") (symbol "}")
 AssocRight AssocRight :: AssocG?Assoc AssocNone AssocNone :: AssocAssoc AssocLeft AssocLeft :: Assoc϶ǶAssocAssocdata AssocNThis data type specifies the associativity of operators: left, right or none. anyTokenanyToken :: (Stream s m t, Show t) => ParsecT s u m t߷StreamsmtShowtParsecTsumtThe parser anyToken accepts any kind of token. It is for example used to implement eof. Returns the accepted token. anyCharanyChar :: Stream s m Char => ParsecT s u m CharStreamsmCharParsecTsumCharFThis parser succeeds for any character. Returns the parsed character. anglesangles :: GenTokenParser s u m -> ParsecT s u m a -> ParsecT s u m aGenTokenParsersumParsecTsumaParsecTsumaLexeme parser angles p parses p enclosed in angle brackets ('<' and '>'), returning the value of p. alphaNumalphaNum :: Stream s m Char => ParsecT s u m Char غStreamsmCharParsecTsumCharZParses a letter or digit (a character between '0' and '9'). Returns the parsed character. addErrorMessageaddErrorMessage :: Message ->  ParseError ->  ParseErrorٻMessage ParseError ParseError<||> (<||>) :: Stream s Identity tok => StreamPermParser s st (a -> b) ->  Parsec s st a -> StreamPermParser s st bStreamsIdentitytokStreamPermParsersstabParsecsstaStreamPermParsersstbThe expression perm <||> p adds parser p to the permutation parser perm. The parser p is not allowed to accept empty input - use the optional combinator (<|?>) instead. Returns a new permutation parser that includes p. <|?> (<|?>) :: Stream s Identity tok => StreamPermParser s st (a -> b) -> (a, Parsec s st a) -> StreamPermParser s st b[ݾStreamsIdentitytokStreamPermParsersstab(,)aParsecsstaStreamPermParsersstb.The expression perm <||> (x,p) adds parser p to the permutation parser perm. The parser p is optional - if it can not be applied, the default value x will be used instead. Returns a new permutation parser that includes the optional parser p. <|> (<|>) ::  Monad m => ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a^ MonadmParsecTsumaParsecTsumaParsecTsumaThis combinator implements choice. The parser p <|> q first applies p. If it succeeds, the value of p is returned. If p fails without consuming any input, parser q is tried. This combinator is defined equal to the mplus member of the MonadPlus class and the (Control.Applicative.<|>) member of Control.Applicative.Alternative. The parser is called predictive since q is only tried when parser p didn't consume any input (i.e.. the look ahead is 1). This non-backtracking behaviour allows for both an efficient implementation of the parser combinators and the generation of good error messages.  () ::  Monad m => ParsecT s u m a -> String -> ParsecT s u m aMonadmParsecTsumaStringParsecTsumaThe parser p ? msg behaves as parser p, but whenever the parser p fails without consuming any input, it replaces expect error messages with the expect error message msg. This is normally used at the end of a set alternatives where we want to return an error message in terms of a higher level construct rather than returning all possible characters. For example, if the expr parser from the try example would fail, the error message is: '...: expecting expression'. Without the (<?>) combinator, the message would be like '...: expecting "let" or letter', which is less friendly. <$?> (<$?>) :: Stream s Identity tok => (a -> b) -> (a, Parsec s st a) -> StreamPermParser s st bcStreamsIdentitytokab(,)aParsecsstaStreamPermParsersstbUThe expression f <$?> (x,p) creates a fresh permutation parser consisting of parser p. The the final result of the permutation parser is the function f applied to the return value of p. The parser p is optional - if it can not be applied, the default value x will be used instead. <$$> (<$$>) :: Stream s Identity tok => (a -> b) ->  Parsec s st a -> StreamPermParser s st bHStreamsIdentitytokabParsecsstaStreamPermParsersstb1The expression f <$$> p creates a fresh permutation parser consisting of parser p. The the final result of the permutation parser is the function f applied to the return value of p. The parser p is not allowed to accept empty input - use the optional combinator (<$?>) instead. If the function f takes more than one parameter, the type variable b is instantiated to a functional type which combines nicely with the adds parser p to the (<||>) combinator. This results in stylized code where a permutation parser starts with a combining function f followed by the parsers. The function f gets its parameters in the order in which the parsers are specified, but actual input can be in any order.  SourcePosdata  SourcePosThe abstract data type SourcePos represents source positions. It contains the name of the source (i.e. file name), a line number and a column number. SourcePos is an instance of the Show, Eq and Ord class.  sourceName sourceName ::  SourcePos ->  SourceNameoU SourcePos SourceName8Extracts the name of the source from a source position.  SourceNametype  SourceName = String sourceLine sourceLine ::  SourcePos -> LineP< SourcePosLine1Extracts the line number from a source position.  sourceColumn sourceColumn ::  SourcePos -> Column SourcePosColumn3Extracts the column number from a source position.  setSourceName setSourceName ::  SourcePos ->  SourceName ->  SourcePos SourcePos SourceName SourcePosSet the name of the source.  setSourceLine setSourceLine ::  SourcePos -> Line ->  SourcePosbC SourcePosLine SourcePos*Set the line number of a source position. setSourceColumnsetSourceColumn ::  SourcePos -> Column ->  SourcePos  SourcePosColumn SourcePos,Set the column number of a source position.  ParseErrordata  ParseError>The abstract data type ParseError represents parse errors. It provides the source position (SourcePos) of the error and a list of error messages (Message). A ParseError can be returned by the function Text.Parsec.Prim.parse. ParseError is an instance of the Show class. Linetype Line = Int incSourceLine incSourceLine ::  SourcePos -> Line ->  SourcePosc SourcePosLine SourcePos1Increments the line number of a source position. incSourceColumnincSourceColumn ::  SourcePos -> Column ->  SourcePosG& SourcePosColumn SourcePos3Increments the column number of a source position. errorPoserrorPos ::  ParseError ->  SourcePos ParseError SourcePos2Extracts the source position from the parse error Columntype Column = IntR Tokenmodule Text.ParserCombinators.Parsec.TokenParsec compatibility module Tokenmodule Text.Parsec.TokensA helper module to parse lexical elements (tokens). See makeTokenParser for a description of how to use it.  Stringmodule Text.Parsec.StringGMake Strings an instance of Stream with Char token type. Primmodule Text.ParserCombinators.Parsec.Prim,Parsec compatibility module Primmodule Text.Parsec.Prim~"The primitive parser combinators.  Posmodule Text.ParserCombinators.Parsec.PosParsec compatibility module Posmodule Text.Parsec.Pos6Textual source positions. Permmodule Text.ParserCombinators.Parsec.PermParsec compatibility module Permmodule Text.Parsec.Perm6This module implements permutation parsers. The algorithm used is fairly complex since we push the type system to its limits :-) The algorithm is described in: Parsing Permutation Phrases, by Arthur Baars, Andres Loh and Doaitse Swierstra. Published as a functional pearl at the Haskell Workshop 2001. parsecpackage parsecKjMonadic parser combinators Parsec is designed from scratch as an industrial-strength parser library. It is simple, safe, well documented (on the package homepage), has extensive libraries and good error messages, and is also fast. It is defined as a monad transformer that can be stacked on arbitrary monads, and it is also parametric in the input stream type. Parsecmodule Text.ParserCombinators.ParsecParsec compatibility module Parsecmodule Text.ParsecI Lazymodule Text.Parsec.ByteString.LazyPMake lazy ByteStrings an instance of Stream with Char token type. Languagemodule Text.ParserCombinators.Parsec.Language*Parsec compatibility module Languagemodule Text.Parsec.LanguageA helper module that defines some language definitions that can be used to instantiate a token parser (see Text.Parsec.Token). Exprmodule Text.ParserCombinators.Parsec.ExprRParsec compatibility module Exprmodule Text.Parsec.ExprhA helper module to parse "expressions". Builds a parser given a table of operators and associativities. Errormodule Text.ParserCombinators.Parsec.ErrorVParsec compatibility module Errormodule Text.Parsec.Error Parse errors  Combinatormodule Text.ParserCombinators.Parsec. Combinator Parsec compatibility module  Combinatormodule Text.Parsec. Combinatori"Commonly used generic combinators Charmodule Text.ParserCombinators.Parsec.CharParsec compatibility module Charmodule Text.Parsec.Char%!Commonly used character parsers.  ByteStringmodule Text.Parsec. ByteStringRMake strict ByteStrings an instance of Stream with Char token type. fT<v^J&tb>TextParserCombinatorsParsecPermTextParsecPermTextParserCombinatorsParsecLanguageTextParsecLanguageTextParsecTextParserCombinatorsParsecExprTextParserCombinatorsParsecTextParserCombinatorsParsecPrimTextParserCombinatorsParsecCharTextParsecStringTextParsec ByteStringTextParsec ByteStringLazyTextParserCombinatorsParsecPosTextParserCombinatorsParsecTokenTextParsecTokenTextParsecCharTextParsecExprTextParserCombinatorsParsec CombinatorTextParsec CombinatorTextParsecPrimTextParserCombinatorsParsecErrorTextParsecErrorTextParsecPosparsec3.0.0Bhttp://hackage.haskell.org/packages/archive/parsec/3.0.0/doc/html/Ahttp://hackage.haskell.org/cgi-bin/hackage-scripts/package/parsec