h$fYȎ      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~                                           (C) 2011-2019 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  experimental non-portable Safe-Inferred4(c) Edward Kmett 2011-2019 (c) Ross Paterson 2008 BSD-styleekmett@gmail.com experimental  trifecta8Map of closed intervals, possibly with duplicates. The  and ; instances process the intervals in lexicographical order.trifectaA closed interval. The lower bound should be less than or equal to the higher bound. trifectaO(n)). Add a delta to each interval in the map trifectaO(1)$. Interval map with a single entry. trifectaO(log n). Insert an interval into a map. The map may contain duplicate intervals; the new entry will be inserted before any existing entries for the same interval.trifecta O(k log (n/k)). All intervals that contain the given interval, in lexicographical order.trifecta O(k log (n/k)). All intervals that contain the given point, in lexicographical order.trifecta O(k log (n/k)). All intervals that intersect with the given interval, in lexicographical order.%trifecta O(m log (n/m)). Merge two interval maps. The map may contain duplicate intervals; entries with equal intervals are kept in the original order.     (C) 2011-2019 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  experimental non-portable Safe-Inferred (C) 2011-2019 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  experimental non-portable Safe-Inferred38 0trifecta;Since there are multiple ways to be at a certain location, 03 captures all these alternatives as a single type.1trifecta +( number of characters , number of bytes ) 2trifecta ( number of characters before the tab , number of characters after the tab , number of bytes ) 3trifecta ( number of newlines contained , number of characters since the last newline , number of bytes , number of bytes since the last newline ) 4trifecta ( current file name , number of lines since the last line directive , number of characters since the last newline , number of bytes , number of bytes since the last newline ) 7trifecta Example: file.txt:12:348trifectaRetrieve the character offset within the current line from this 0.9trifecta;Retrieve the byte offset within the current line from this 0.:trifecta.Increment a column number to the next tabstop.;trifecta Rewind a 0 to the beginning of the line.<trifecta!Should we show two things with a 0 on the same line? near (Columns 0 0) (Columns 5 5)True$near (Lines 1 0 1 0) (Lines 2 4 4 2)False./0312456789:;<03124./567:;<89(C) 2011-2019 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  experimental non-portable Safe-Inferred 38>QtrifectaData of a certain lengthRtrifecta#Absence of data of a certain lengthStrifectaConstruct a single P out of a .Utrifecta Construct a N out of a single  strand.Wtrifecta"Grab the entire rest of the input N, starting at an initial offset, or return a default if we@re already at or beyond the end. Also see X.4Extract a suffix of a certain length from the input:grabRest (delta ("Hello " :: ByteString)) (ropeBS "Hello World\nLorem") Nothing (\x y -> Just (x, Lazy.toString y))!Just (Columns 6 6,"World\nLorem")%Same deal, but over multiple strands:grabRest (delta ("Hel" :: ByteString)) (ropeBS "Hello" <> ropeBS "World") Nothing (\x y -> Just (x, Lazy.toString y))Just (Columns 3 3,"loWorld")4When the offset is too long, fall back to a default:grabRest (delta ("OffetTooLong" :: ByteString)) (ropeBS "Hello") Nothing (\x y -> Just (x, Lazy.toString y))NothingXtrifecta;Grab the rest of the line at a certain offset in the input N, or return a default if there is no newline left in the input. Also see W.grabLine (delta ("Hello " :: ByteString)) (ropeBS "Hello" <> ropeBS " World\nLorem") Nothing (\x y -> Just (x, Strict.toString y))Just (Columns 6 6,"World\n")WtrifectaInitial offsettrifectaInputtrifecta'Default value if there is no input lefttrifecta'If there is some input left, create an r7 out of the data from the initial offset until the endXtrifectaInitial offsettrifectaInputtrifecta'Default value if there is no input lefttrifecta'If there is some input left, create an r out of the data from the initial offset until the end of the line NOPQRSTUVWX NOTUPQRSVWX(C) 2011-2019 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  experimental non-portable Safe-Inferred ) ktrifectak is an  0https://wiki.haskell.org/Enumerator_and_iterateeIteratee# that can produce partial results.k r a consumes a feed of rs and produces a+s on the way. New values can be fed using n<, the current (partial or final) result is extracted using .let keepIt a = Pure a let replaceIt a = It a replaceItextract (keepIt 0)0extract (replaceIt 0)0!extract (simplifyIt (keepIt 0) 5)0$extract (simplifyIt (replaceIt 0) 5)5ltrifecta+Final result, rest of the feed is discardedmtrifecta8Intermediate result, consumed values produce new resultsntrifectaFeed a value to k,, obtaining a new (partial or final) result.otrifecta-Consumes input until a value can be produced.:{let needTen = needIt 0 (\n -> if n < 10 then Nothing else Just n) :: It Int Int:}extract needTen0extract (simplifyIt needTen 5)0extract (simplifyIt needTen 11)11>extract (simplifyIt (simplifyIt (simplifyIt needTen 5) 11) 15)11ptrifectaConsumes input and produces partial results until a condition is met. Unlike o, partial results are already returned when the condition is not fulfilled yet. >>> :{ let wantTen :: It Int Int wantTen = wantIt 0 (\n -> (# n >= 10, n #)) :} >>> extract wantTen 0 $>>> extract (simplifyIt wantTen 5) 5 &>>> extract (simplifyIt wantTen 11) 11 >>> extract (simplifyIt (simplifyIt (simplifyIt wantTen 5) 11) 15) 11qtrifecta>The generalized fold (Bhm-Berarducci decoding) over 'It r a'.q satisfies the property: foldIt Pure It = idrtrifectaScott decoding of 'It r a'.The scott decoding is similar to the generalized fold over a data type, but leaves the recursion step to the calling function.r satiesfies the property: runIt Pure It = id%See also the Scott decoding of lists: +runList :: (a -> [a] -> b) -> b -> [a] -> band compare it with * (the Bhm-Berarducci decoding for lists): 'foldr :: (a -> b -> b) -> b -> [a] -> bstrifectaGiven a position, go there, and grab the rest of the line forward from that point.:set -XOverloadedStringslet secondLine = fillIt Nothing (const Just) (delta ("foo\nb" :: Strict.ByteString))extract secondLineNothing.extract (simplifyIt secondLine (ropeBS "foo"))Nothing3extract (simplifyIt secondLine (ropeBS "foo\nbar")) Just "ar"8extract (simplifyIt secondLine (ropeBS "foo\nbar\nbaz")) Just "ar\n"ttrifecta:Return the text of the line that contains a given position:set -XOverloadedStringslet secondLine = rewindIt (delta ("foo\nb" :: Strict.ByteString))extract secondLineNothing.extract (simplifyIt secondLine (ropeBS "foo"))Nothing3extract (simplifyIt secondLine (ropeBS "foo\nbar")) Just "bar"8extract (simplifyIt secondLine (ropeBS "foo\nbar\nbaz")) Just "bar\n"utrifecta$Return the text between two offsets.:set -XOverloadedStringslet secondLine = sliceIt (delta ("foo\n" :: Strict.ByteString)) (delta ("foo\nbar\n" :: Strict.ByteString))extract secondLine"".extract (simplifyIt secondLine (ropeBS "foo"))""3extract (simplifyIt secondLine (ropeBS "foo\nbar"))"bar"8extract (simplifyIt secondLine (ropeBS "foo\nbar\nbaz"))"bar\n"vtrifectak is a cofree comonadotrifectaInitial resulttrifectaProduce a result if possibleptrifectaInitial resulttrifecta!Produce a partial or final result klmnopqrstu klmopnqrstu(C) 2011-2019 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  experimental non-portableNone38>2}trifectaA }3 is a canvas of text that output can be written to.trifecta0A raw canvas to paint ANSI-styled characters on.trifectaA  is a  with a suggestion.unAnnotate (prettyRendering (addFixit (Columns 35 35) (Columns 38 38) "Fix this!" exampleRendering))21 | int main(int argc, char ** argv) { int; }* | ~~~0 | Fix this!trifecta where the error occurredtrifectaReplacement suggestiontrifecta+Annotate an arbitrary piece of data with a ., typically its corresponding input location.trifectaA ' marks a range of input characters. If  is a point, then  is a line.unAnnotate (prettyRendering (addSpan (Columns 35 35) (Columns 38 38) exampleRendering))21 | int main(int argc, char ** argv) { int; }* | ~~~trifectaA * marks a point in the input with a simple ^ character.unAnnotate (prettyRendering (addCaret (Columns 35 35) exampleRendering))21 | int main(int argc, char ** argv) { int; }( | ^trifecta 8( Number of (padded) columns , number of bytes , line ) trifectaIs the } empty?nullRendering emptyRenderingTruenullRendering exampleRenderingFalsetrifecta The empty } , which contains nothing at all.%show (prettyRendering emptyRendering)""trifectacreate a drawing surfacetrifecta-ANSI terminal style for rendering the gutter.trifecta,ANSI terminal style for rendering the caret.trifecta*Render a caret at a certain position in a }.trifecta)ANSI terminal style to render spans with.trifectaANSI style to usetrifectaLine; 0 is at the toptrifectaColumn; 0 is on the lefttrifectaData to be writtentrifectaCanvas to draw ontrifecta Position 1trifecta0Modify the fallback result if the positions are < each othertrifecta Position 2trifecta)Fallback result if the positions are not < each othertrifectaStart of the region of interesttrifectaEnd of the region of interesttrifectaCurrrent locationtrifecta to add the rendering to5}~5}~(c) Edward Kmett 2011-2019BSD3ekmett@gmail.com experimental non-portableNone567>?7+trifectaThis is used to report an error. What went wrong, some supplemental docs and a set of things expected at the current location. This does not, however, include the actual location.trifectaA # that lets you embed or retrieve a  in a potentially larger type.trifectaThe result of parsing. Either we succeeded or something went wrong.trifectaGenerate a simple $ word-wrapping the supplied message.trifecta Convert a }! of auxiliary information and an  into a 'Doc AnsiStyle', ready to be prettyprinted to the user.trifecta Fold over a trifectaThe  for the  constructor of trifectaThe  for the  constructor of (C) 2011-2019 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  experimental non-portableNone 9dtrifectaA  is a N with an associated  full of highlighted regions.trifecta Convert a  into a coloration on a .trifecta;Represents a source file like an HsColour rendered documenttrifecta-Generate an HTML document from a title and a .5(c) Edward Kmett 2011-2019BSD3ekmett@gmail.com experimental non-portableNone>??trifectaThis class is a refinement of  that adds the ability to mark your position in the input and return there for further parsing later.trifectamark the current location so it can be used in constructing a span, or for later seekingtrifecta!Seek a previously marked locationtrifecta0This class provides parsers with easy access to:<1) the current line contents. 2) the current position as a 0. 3) the ability to use  on any parser.trifectaRetrieve the contents of the current line (from the beginning of the line)trifecta#Retrieve the current position as a 0.trifectaRun a parser, grabbing all of the text between its start and end pointstrifecta Retrieve a }> of the current line noting this position, but not placing a  there.trifecta&Grab the remainder of the current linetrifectaRun a parser, grabbing all of the text between its start and end points and discarding the original resulttrifectaGrab a " pointing to the current location.trifectaParse a  result. Pointing the  to where you start.trifecta+Discard the result of a parse, returning a 0 from where we start to where it ended parsing.trifectaParse a  result. The 3 starts here and runs to the last position parsed.trifecta Grab a fixit. (c) Edward Kmett 2011-2019BSD3ekmett@gmail.com experimental non-portableNone567>?OW trifectaA 1 allows for incremental parsing, since the parsercan be done with a final result have errored return () Just a -> print $ sum atrifecta( p filePath) runs a parser p on the input read from filePath using  . Returns all diagnostic messages emitted over the course of the parse and the answer if the parse was successful. main = do result <- parseFromFileEx (many number) "digits.txt" case result of Failure xs -> displayLn xs Success a -> print (sum a)trifectaFully parse a  to a .parseByteString p delta i runs a parser p on i.trifectaFully parse a  to a .parseByteString p delta i runs a parser p on i.trifecta"Starting cursor position. Usually  for the beginning of the file.trifecta"Starting cursor position. Usually  for the beginning of the file.trifecta"Starting cursor position. Usually  for the beginning of the file.trifecta"Starting cursor position. Usually  for the beginning of the file.(C) 2011-2019 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  experimental non-portableNoneP6NOPQRSTUVWX}~ NoneYtrifectaIn order to keep things minimal, we define a very simple language for arithmetic expressions.trifecta expr + exprtrifecta 1, 2, -345, @trifectaFirst, we import Trifecta itself. It only the core parser definitions and instances. Since Trifecta on its own is just the parser and a handful of instances; the bulk of the utility functions is actually from a separate package, parsers2, that provides the usual parsing functions like , !, and so on. The idea behind the parsers package is that most parser libraries define the same generic functions, so they were put into their own package to be shared. Trifecta reexports these definitions, but it@s useful to keep in mind that the documentation of certain functions might not be directly in the trifecta package.trifectaThe parser is straightforward: there are literal integers, and parenthesized additions. We require parentheses in order to keep the example super simple as to not worry about operator precedence.It is useful to use  tokenizing functions to write parsers. Roughly speaking, these automatically skip trailing whitespace on their own, so that the parser isn@t cluttered with skipWhitespace calls.  for example parses a  and then skips trailing whitespace; there is also the more primitive : function that just parses its argument and nothing else.trifecta'We can now use our parser to convert a  to an , -parseString parseExpr mempty "(1 + (2 + 3))"  +Success (Add (Lit 1) (Add (Lit 2) (Lit 3)))When we provide ill-formed input, we get a nice error message with an arrow to the location where the error occurred: ,parseString parseExpr mempty "(1 + 2 + 3))" (interactive):1:8: error: expected: ")" 1 | (1 + 2 + 3)) | ^ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]]^^_`abcdefghijklmnopqrstuvwxyxz{|}~B                                                       %trifecta-2.1.2-FxIVblsv0vMHPVoI9gVV49Text.Trifecta.HighlightText.Trifecta.Util.IntervalMapText.Trifecta.DeltaText.Trifecta.RopeText.Trifecta.Util.ItText.Trifecta.RenderingText.Trifecta.ResultText.Trifecta.CombinatorsText.Trifecta.ParserText.Trifecta.TutorialText.Trifecta.Util.CombinatorsText.Trifecta.Util.Pretty ByteStringreadFile Text.Trifecta&parsers-0.12.10-6kKOlfPKUZXHLr1aiouqizText.Parser.Token.Highlight Highlight IntervalMaprunIntervalMap IntInterval NoIntervalIntervallowhighoffset singletoninsert dominatorssearch intersectionsfromList$fTraversableInterval$fFoldableInterval$fFunctorInterval $fOrdInterval $fEqInterval$fReducervInterval$fSemigroupInterval"$fTraversableWithIndexIntervalNode$fTraversableNode$fFoldableWithIndexIntervalNode$fFoldableNode$fFunctorWithIndexIntervalNode $fFunctorNode$fMeasuredIntIntervalNode$fSemigroupIntInterval$fMonoidIntInterval$fSemigroupIntervalMap$fMonoidIntervalMap$fHasUnion0IntervalMap$fHasUnionIntervalMap $fMeasuredIntIntervalIntervalMap)$fTraversableWithIndexIntervalIntervalMap$fTraversableIntervalMap&$fFoldableWithIndexIntervalIntervalMap$fFoldableIntervalMap%$fFunctorWithIndexIntervalIntervalMap$fFunctorIntervalMap$fShowIntervalHasDeltadeltaDeltaColumnsTabLinesDirectedHasBytesbytes prettyDeltacolumn columnBytenextTabrewindnear$fHasBytesFingerTree$fHasBytesByteString$fSemigroupDelta $fMonoidDelta$fHashableDelta$fHasBytesDelta $fOrdDelta $fEqDelta$fHasDeltaFingerTree$fHasDeltaByteString$fHasDeltaWord8$fHasDeltaChar$fHasDeltaDelta$fHasDeltaEither $fShowDelta $fDataDelta$fGenericDeltaRopeStrandSkippingstrandroperopeBSstrandsgrabRestgrabLine$fHasBytesStrand$fHasDeltaStrand$fHashableStrand$fMeasuredDeltaStrand$fReducer[]Rope$fReducerByteStringRope$fReducerStrandRope$fReducerRopeRope$fSemigroupRope $fMonoidRope$fMeasuredDeltaRope$fHasDeltaRope$fHasBytesRope $fShowRope $fEqStrand $fShowStrand $fDataStrand$fGenericStrandItPure simplifyItneedItwantItfoldItrunItfillItrewindItsliceIt $fComonadIt$fComonadApplyIt $fMonadIt$fApplicativeIt$fProfunctorIt $fFunctorIt$fShowIt RenderingdrawFixit _fixitSpan_fixitReplacementSpanned:~HasSpanspanSpanCareted:^HasCaretcaretCaretRendered:@Sourcesource Renderablerender HasRendering renderingrenderingDelta renderingLinerenderingLineBytesrenderingLineLenrenderingOverlays nullRenderingemptyRenderingifNearrendered.#prettyRendering gutterEffects caretEffects drawCaretaddCaretrenderingCaret spanEffectsdrawSpanaddSpan drawFixitaddFixit$fHasDeltaRendering$fMonoidRendering$fSemigroupRendering$fShowRendering$fHasRenderingRendering$fRenderableRendering$fSourceByteString $fSource[]$fRenderableRendered$fTraversableRendered$fFoldableRendered$fComonadApplyRendered$fComonadRendered$fHasBytesRendered$fHasDeltaRendered$fFunctorRendered$fSemigroupCaret$fReducerCaretRendering$fRenderableCaret$fHasDeltaCaret$fHasBytesCaret$fHashableCaret$fHasCaretCaret$fHashableCareted$fReducerCaretedRendering$fRenderableCareted$fTraversableCareted$fFoldableCareted$fComonadApplyCareted$fComonadCareted$fHasBytesCareted$fHasDeltaCareted$fFunctorCareted$fHasCaretCareted$fHashableSpan$fReducerSpanRendering$fSemigroupSpan$fRenderableSpan $fHasSpanSpan$fHashableSpanned$fRenderableSpanned$fReducerSpannedRendering$fTraversableSpanned$fFoldableSpanned$fComonadApplySpanned$fComonadSpanned$fFunctorSpanned$fHasSpanSpanned $fEqFixit $fOrdFixit $fShowFixit $fDataFixit$fGenericFixit $fEqSpanned $fOrdSpanned $fShowSpanned $fDataSpanned$fGenericSpanned$fEqSpan $fOrdSpan $fShowSpan $fDataSpan $fGenericSpan $fEqCareted $fOrdCareted $fShowCareted $fDataCareted$fGenericCareted $fEqCaret $fOrdCaret $fShowCaret $fDataCaret$fGenericCaret$fShowRenderedHasFixitfixitfixitReplacement fixitSpan$fRenderableFixit$fReducerFixitRendering$fHashableFixit$fHasSpanFixit$fHasFixitFixitErr_reason _footnotes _expected _finalDeltasErrInfo_errDoc _errDeltas $fShowErrInfoAsResult_ResultResultSuccessFailureErrableraiseErrHasErrerrexpected finalDeltas footnotesreasonfailedexplain foldResult_Success_Failure$fSemigroupErrInfo$fMonoidErrInfo $fMonoidErr$fSemigroupErr $fHasErrErr $fMonadResult$fAlternativeResult$fApplicativeResult$fAsResultResultResultab $fShowResult$fFunctorResult$fFoldableResult$fTraversableResultHighlightedRope withHighlight HighlightDocHasHighlightedRopehighlightedRope ropeContentropeHighlights$fMonoidHighlightedRope$fSemigroupHighlightedRope$fHasBytesHighlightedRope$fHasDeltaHighlightedRope#$fHasHighlightedRopeHighlightedRope$fToMarkupHighlightedRope $fOrdLocated $fEqLocatedHasHighlightDoc highlightDoc docContentdocCssdocTitledoc$fToMarkupHighlightDoc$fHasHighlightDocHighlightDoc MarkParsingmarkrelease DeltaParsinglineposition slicedWithrend restOfLineslicedcaretingcaretedspanningspannedfixiting$fDeltaParsingIdentityT$fDeltaParsingRWST$fDeltaParsingRWST0$fDeltaParsingWriterT$fDeltaParsingWriterT0$fDeltaParsingReaderT$fDeltaParsingStateT$fDeltaParsingStateT0$fMarkParsingdIdentityT$fMarkParsingdRWST$fMarkParsingdRWST0$fMarkParsingdWriterT$fMarkParsingdWriterT0$fMarkParsingdReaderT$fMarkParsingdStateT$fMarkParsingdStateT0StepStepDoneStepFailStepContParserunparser manyAccumfeedstarve stepResultstepIt stepParser runParser parseFromFileparseFromFileExparseByteString parseString parseTest$fMarkParsingDeltaParser$fDeltaParsingParser$fTokenParsingParser$fCharParsingParser$fLookAheadParsingParser$fErrableParser$fParsingParser$fMonadPlusParser$fMonadFailParser $fMonadParser$fMonoidParser$fSemigroupParser$fAlternativeParser$fApplicativeParser$fFunctorParser $fFunctorStep $fShowStepExprAddLitimportDocumentation parseExprexamples $fShowExprargminargmaxfromLazytoLazytakeLine<$!>base Data.FoldableFoldableData.Traversable Traversable8prettyprinter-ansi-terminal-1.1.3-A1tBSZpA4Ba7orFVBDqu1X&Prettyprinter.Render.Terminal.InternalrenderIO underlinedbold AnsiStylechar renderPrettydebold deunderlinecolumnsbytestring-0.10.10.0Data.ByteString.Internal#comonad-5.0.8-DjWFEeEb2V35R3yc0GXZrControl.ComonadextractData.ByteStringfoldrlens-5.1-ChRmCBZC48iAC6Ej6yLZYControl.Lens.TypePrism)prettyprinter-1.7.1-BauxLiNvN3EiJKyXe93SMPrettyprinter.InternalDocGHC.Basepureempty Alternative<|>Text.Parser.CombinatorstryStringmemptymanysomeControl.ApplicativeoptionalText.Parser.Tokenoctal hexadecimaldecimalinteger' characterCharident reserveTextreserveliftIdentifierStylestyleHighlightsstyleReservedHighlightstyleHighlight styleReserved styleChars styleLetter styleStart styleName commaSep1commaSepsemiSep1semiSepdotcoloncommabracketsanglesbracesparenssymbolic textSymbolsymbolintegerOrScientificnaturalOrScientific scientificintegerOrDoublenaturalOrDoubledoubleintegernaturalstringLiteral' stringLiteral charLiteral whiteSpace TokenParsingnesting someSpace highlighttokensemiIdentifierStyle_styleReservedHighlight_styleHighlight_styleReserved _styleLetter _styleName _styleStart UnhighlightedrunUnhighlightedUnspaced runUnspacedUnlined runUnlinedText.Parser.Char satisfyRangeoctDigithexDigitdigitletteralphaNumloweruppertabnewlinespacespaces noneOfSetoneOfSetnoneOfoneOf CharParsingnotCharanyCharsatisfytextstringmanyTillchainr1chainl1chainlchainrcountendBy endByNonEmptyendBy1sepEndBysepEndByNonEmpty sepEndBy1 sepByNonEmptysepBy1sepBy surroundedBybetween skipOptionaloptionchoiceParsingskipSome notFollowedBy unexpectedeofskipManyghc-prim GHC.TypesChar