h$MxJs      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ Safe-Inferred  8>  core-textConversion to and from various types containing binary data into our convenience Bytes type.&As often as not these conversions are  expensive; these methods are here just to wrap calling the relevant functions in a uniform interface. core-textA block of data in binary form. core-textAccess the strict  underlying the  type. core-textA zero-length . core-textFor the annoyingly common case of needing to take an ASCII string literal in your code and use it as a bunch of . Done via Data.ByteString.Char8 so all s will be truncated to 8 bits (i.e. Latin-1 characters less than 255). You should probably consider this to be unsafe. Also note that we deliberately do not have a [Char] instance of ;; if you need to come back to a textual representation use . core-textOutput the content of the  to the specified .  hOutput h b  & provides a convenient way to write a Bytes, to a file or socket handle from within the   monad.$Don't use this function to write to stdout if you are using any of the other output or logging facililities of this libarary as you will corrupt the ordering of output on the user's terminal. Instead do:    ( b) on the assumption that the bytes in question are UTF-8 (or plain ASCII) encoded. core-text;Read the (entire) contents of a handle into a Bytes object.>If you want to read the entire contents of a file, you can do:  contents <-   name    At any kind of scale, Streaming I/O is almost always for better, but for small files you need to pick apart this is fine.  core-textfrom  Data.Word  core-textfrom Data.ByteString.Lazy  core-textfrom Data.ByteString Strict  None 08>& core-textMachinery to interpret a type as containing valid Unicode that can be represented as a  object.Implementation notes Given that  is backed by a finger tree,  is relatively inexpensive, plus whatever the cost of conversion is. There is a subtle trap, however: if adding small fragments of that were obtained by slicing (for example) a large  we would end up holding on to a reference to the entire underlying block of memory. This module is optimized to reduce heap fragmentation by letting the Haskell runtime and garbage collector manage the memory, so instances are expected to copy' these substrings out of pinned memory.The  instance requires that its content be valid UTF-8. If not an empty  will be returned.Several of the  implementations are expensive and involve a lot of intermediate allocation and copying. If you're ultimately writing to a handle prefer )0 which will write directly to the output buffer. core-text Convert a Rope into another text-like type. core-text0Take another text-like type and convert it to a Rope. core-textAppend some text to this Rope. The default implementation is basically a convenience wrapper around calling  and ing it to your text (which will work just fine, but for some types more efficient implementations are possible). core-textThe length of the Rope, in characters. This is the monoid used to structure the finger tree underlying the Rope. core-textA type for textual data. A rope is text backed by a tree data structure, rather than a single large continguous array, as is the case for strings.There are three use cases:#Referencing externally sourced dataOften we interpret large blocks of data sourced from external systems as text. Ideally we would hold onto this without copying the memory, but (as in the case of  ByteString which is the most common source of data) before we can treat it as text we have to validate the UTF-8 content. Safety first. We also copy it out of pinned memory, allowing the Haskell runtime to manage the storage.#Interoperating with other librariesThe only constant of the Haskell universe is that you won't have the right combination of {strict, lazy}  {Text,  ByteString, String, [Word8]0, etc} you need for the next function call. The  typeclass provides for moving between different text representations. To convert between Rope and something else use ; to construct a Rope* from textual content in another type use .3You can get at the underlying finger tree with the  function.Assembling text to go outThis involves considerable appending of data, very very occaisionally inserting it. Often the pieces are tiny. To add text to a Rope use the  method as below or the () operator from  Data.Monoid (like you would have with a Builder). Output to a Handle can be done efficiently with ). core-text&Access the finger tree underlying the Rope$. You'll want the following imports: import qualified Data.FingerTree as F -- from the  fingertree package import qualified Data.Text.Short as S -- from the  text-short package  core-textA zero-length . You can also use "" presuming the OverloadedStrings5 language extension is turned on in your source file. core-textA  with but a single character. core-textA 8 built from a list of characters. Equivalent to calling  on the String, but can help you avoid ambiguious type errors when composing functions or working with literals. core-textRepeat the input  n0 times. The follows the same semantics as other  replicate functions; if you ask for zero copies you'll get an empty text and if you ask for lots of "" you'll get ... an empty text.Implementation noteRather than copying the input n/ times, this will simply add structure to hold n' references to the provided input text. core-textRepeat the input  n" times. This is a special case of  above.Implementation noteRather than making a huge FingerTree full of single characters, this function will allocate a single ShortText comprised of the repeated input character.  core-text+Get the length of this text, in characters." core-text Read the first character from a /, assuming it's length 1 or greater, returning 7 that character and the remainder of the text. Returns  if the input is 0 length.# core-text7Break the text into two pieces at the specified offset. Examples: > splitRope 0 "abcdef" ("", "abcdef") > splitRope 3 "abcdef" ("abc", "def") > splitRope 6 "abcdef" ("abcdef","") &Going off either end behaves sensibly: > splitRope 7 "abcdef" ("abcdef","") > splitRope (-1) "abcdef" ("", "abcdef") $ core-text=Take the first _n_ characters from the beginning of the Rope. > takeRope 3 "123456789" "123" % core-text,Insert a new piece of text into an existing Rope at the specified offset. Examples: > insertRope 3 "Con" "Def 1" "DefCon 1" >  insertRope 0 "United " "Nations" "United Nations" ' core-textCopy the pieces underlying a  into a single piece object.Warning/This function was necessary to have a reliable + instance. Currently constructing this new  is quite inefficient if the number of pieces or their respective lengths are large. Usually, however, we're calling  so the value can be used as a key in a hash table and such keys are typically simple (or at least not ridiculously long), so this is not an issue in normal usage.( core-textIf you know the input bytes are valid UTF-8 encoded characters, then you can use this function to convert to a piece of Rope.) core-text Write the  to the given . import  Core.Text import  Core.System: -- re-exports stdout main :: IO () main = let text :: " text = "Hello World" in )  text because it's tradition.Uses  internally which saves all kinds of intermediate allocation and copying because we can go from the s in the finger tree to  to  to the s output buffer in one go.If you're working in the < https://hackage.haskell.org/package/core-program/docs/Core-Program-Execute.html#t:Program Program> monad, then < https://hackage.haskell.org/package/core-program/docs/Core-Program-Logging.html#v:write- write> provides an efficient way to write a Rope to stdout.* core-text%Does the text contain this character?=We've used it to ask whether there are newlines present in a Rope, for example:  if * '\n' text then handleComplexCase else keepItSimple 6 core-textfrom  Data.String9 core-textfrom Data.ByteString.Lazy: core-textfrom Data.ByteString Strict; core-textfrom Data.Text.Lazy< core-textfrom  Data.Text Strict= core-textfrom Data.Text.Short !"#$%&'()* "#$%*&)!('None ( G core-textCalculate the line number and column number of a Rope (interpreting it as if is a block of text in a file). By the convention observed by all leading brands of text editor, lines and columns are 1& origin, so an empty Rope is position (1,1).GNone 2H core-textAn accumulation of ANSI escape codes used to add colour when pretty printing to console.I core-textConvert an AnsiColour into the ANSI escape sequences which will make that colour appear in the user's terminal.J core-textMedium "Scarlet Red" (#cc0000 from the Tango color palette).K core-textHighlighted "Scarlet Red" (#ef2929 from the Tango color palette).L core-text'Pure "Red" (full RGB red channel only).M core-textShadowed "Chameleon" (#4e9a06 from the Tango color palette).N core-textHighlighted "Chameleon" (#8ae234 from the Tango color palette).O core-text+Pure "Green" (full RGB green channel only).P core-textMedium "Sky Blue" (#3465a4 from the Tango color palette).Q core-textHighlighted "Sky Blue" (#729fcf from the Tango color palette).R core-text)Pure "Blue" (full RGB blue channel only).S core-textDull "Cyan" (from the gnome-terminal console theme).T core-textBright "Cyan" (from the gnome-terminal console theme).U core-text-Pure "Cyan" (full RGB blue + green channels).V core-textMedium "Plum" (#75507b from the Tango color palette).W core-textHighlighted "Plum" (#ad7fa8 from the Tango color palette).X core-text.Pure "Magenta" (full RGB red + blue channels).Y core-textShadowed "Butter" (#c4a000 from the Tango color palette).Z core-textHighlighted "Butter" (#fce94f from the Tango color palette).[ core-text.Pure "Yellow" (full RGB red + green channels).\ core-text(Pure "Black" (zero in all RGB channels).] core-textShadowed "Deep Aluminium" (#2e3436 from the Tango color palette).^ core-text7Medium "Dark Aluminium" (from the Tango color palette)._ core-textPure "Grey" (set at #999999,, being just over half in all RGB channels).` core-text,Pure "White" (fully on in all RGB channels).a core-textMedium "Light Aluminium" (#d3d7cf from the Tango color palette).b core-textHighlighted "Light Aluminium" (#eeeeec from the Tango color palette).c core-text Given an H, lift it to bold intensity. Note that many console fonts do not have a bold face variant, and terminal emulators that "support bold" do so by doubling the thickness of the lines in the glyphs. This may or may not be desirable from a readibility standpoint but really there's only so much you can do to keep users who make poor font choices from making poor font choices.d core-textThis is not a colour, obviously, but it represents reseting to the default terminal foreground colour, whatever the user has that set to.HIJKLMNOPQRSTUVWXYZ[\]^_`abcdHIcJKLMNOPQRSTUVWXYZ[\]^_`abdNone 7g core-textSplit a passage of text into a list of words. A line is broken wherever there is one or more whitespace characters, as defined by  Data.Char's . Examples: > breakWords "This is a test" ["This","is","a","test"] > +breakWords ("St" <> "op and " <> "go left") ["Stop","and","go","left"] > breakWords emptyRope [] h core-textSplit a paragraph of text into a list of its individual lines. The paragraph will be broken wherever there is a 'n' character.Blank lines will be preserved. Note that as a special case you do not get a blank entry at the end of the a list of newline terminated strings. > breakLines "Hello\n\nWorld\n" ["Hello","","World"] i core-text:Predicate testing whether a character is a newline. After  et al in  Data.Char.j core-textBreak a Rope into pieces whereever the given predicate function returns True. If found, that character will not be included on either side. Empty runs, however, *will* be preserved.m core-textGiven a piece of  and a predicate, break the text into two pieces at the first site where that predicate returns .ghijklmNone  >I n core-textTypes which can be rendered "prettily", that is, formatted by a pretty printer and embossed with beautiful ANSI colours when printed to the terminal.Use u( to build text object for later use or < https://hackage.haskell.org/package/core-program/docs/Core-Program-Logging.html Control.Program.Logging>'s < https://hackage.haskell.org/package/core-program/docs/Core-Program-Logging.html#v:writeR3 writeR> if you're writing directly to console now.o core-textWhich type are the annotations of your Doc going to be expressed in?p core-text6Convert semantic tokens to specific ANSI escape tokensq core-textArrange your type as a  ann&, annotated with your semantic tokens.r core-textNothing should be invoking r.u core-text!Given an object of a type with a n instance, transform it into a Rope saturated with ANSI escape codes representing syntax highlighting or similar colouring, wrapping at the specified width.The obvious expectation is that the next thing you're going to do is send the Rope to console with:    (u 80 thing)  However, the better thing to do is to instead use:   thing which is able to pretty print the document text respecting the available width of the terminal.v core-textHaving gone to all the trouble to colourize your rendered types... sometimes you don't want that. This function is like u, but removes all the ANSI escape codes so it comes outformatted but as plain black & white text.w core-textRender "a" or "an" in front of a word depending on English's idea of whether it's a vowel or not.x core-textGiven a list of items (one word per Rope in the list) enumerate them with commas and an Oxford comma before the last item. As you'd expect: > oxford ["one", "two", "three"] "one, two, and three" Because English is ridiculous, however, and we can't have nice things, two items are a special case: > oxford ["four", "five"] "four and five" Sadly if there is only one item you don't get an Oxford comma, either: > oxford ["six"] "six" >  oxford [] "" y core-textOften the input text represents a paragraph, but does not have any internal newlines (representing word wrapping). This function takes a line of text and inserts newlines to simulate such folding, keeping the line under the supplied maximum width.A single word that is excessively long will be included as-is on its own line (that line will exceed the desired maxium width).&Any trailing newlines will be removed.{ core-textPad a piece of text on the left with a specified character to the desired width. This function is named in homage to the famous result from Computer Science known as leftPad which has a glorious place in the history of the world-wide web.| core-text.Right pad a text with the specified character.} core-textMulti-line string literals.$To use these you need to enable the  QuasiQuotes( language extension in your source file: {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE QuasiQuotes #-} you are then able to easily write a string stretching over several lines.How best to formatting multi-line string literal within your source code is an aesthetic judgement. Sometimes you don't care about the whitespace leading a passage (8 spaces in this example):  let message = [}| This is a test of the Emergency Broadcast System. Do not be alarmed. If this were a real emergency, someone would have tweeted about it by now. |] "because you are feeding it into a  ! for pretty printing and know the renderer will convert the whole text into a single line and then re-flow it. Other times you will want to have the string as is, literally:  let poem = [}| If the sun rises in the west you drank too much last week. |] Leading whitespace from the first line and trailing whitespace from the last line will be trimmed, so this:  let value = [}| Hello |] is translated to:  let value = "# "Hello\n" without the leading newline or trailing four spaces. Note that as string literals they are presented to your code with "# :: String ->  so any type with an "$ instance (as + has) can be constructed from a multi-line [}| ... |] literal.5GHIJKLMNOPQRSTUVWXYZ[\]^_`abcdghijklmnopqrstuvwxyz{|}nopquvwxmghjiyGz{|}kltrs%NoneJ !"#$%&'()*GHIJKLMNOPQRSTUVWXYZ[\]^_`abcdghijklmnqoporstuvwxyz{|}&'()*+,-./0123456789:;<<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~!(core-text-0.3.7.2-2AxYmoPQep57ET1IKdOR5OCore.Text.BytesCore.Text.RopeCore.Text.UtilitiesCore.Text.ColourData.ByteString ByteStringintoRopeCore.Program.ExecuteoutputProgramwriteCore.System.BasewithFileReadModeData.Semigroup<> Data.Hashablehash System.IOstdoutData.ByteString.Builder hPutBuilderData.Text.Short ShortTextData.ByteString.ShortShortByteStringBuilderHandle'Core.Text.ParsingCore.Text.BreakingwriteRData.Text.Prettyprint.DocDoc Data.String fromStringIsString Core.TextBinary fromBytes intoBytesBytesunBytes emptyBytes packByteshOutputhInput$fHashableBytes $fBinary[]$fBinaryBuilder$fBinaryByteString$fBinaryByteString0 $fBinaryBytes $fShowBytes $fEqBytes $fOrdBytes$fGenericBytesTextualfromRope appendRopeWidthRopeunRope emptyRope singletonRopepackRope replicateRope replicateChar widthRopenullRope unconsRope splitRopetakeRope insertRope findIndexRopecopyRopeunsafeIntoRopehWritecontainsCharacter $fMonoidWidth$fSemigroupWidth$fMeasuredWidthShortText$fHashableRope $fMonoidRope$fSemigroupRope$fIsStringRope $fPrettyRope $fOrdRope$fEqRope $fNFDataRope $fTextual[] $fBinaryRope$fTextualBytes$fTextualByteString$fTextualByteString0 $fTextualText$fTextualText0$fTextualShortText $fTextualRope$fTextualFingerTree $fShowRope $fGenericRope $fEqWidth $fOrdWidth $fShowWidth $fNumWidth$fGenericWidthcalculatePositionEnd AnsiColour intoEscapesdullRed brightRedpureRed dullGreen brightGreen pureGreendullBlue brightBluepureBluedullCyan brightCyanpureCyan dullMagenta brightMagenta pureMagenta dullYellow brightYellow pureYellow pureBlackdullGrey brightGreypureGrey pureWhite dullWhite brightWhite boldColour resetColour$fMonoidAnsiColour$fSemigroupAnsiColour breakWords breakLines isNewline breakPieces intoPieces intoChunks breakRopeRenderToken colourize highlightintoDocAbold byteChunkrender renderNoAnsi indefiniteoxfordwrap underline leftPadWith rightPadWithquote $fRenderBytes $fRenderText $fRender[] $fRender[]0 $fRenderChar $fRenderRopeghc-prim GHC.TypesCharbaseGHC.IO.Handle.TypesHandleGHC.Basemappend GHC.MaybeJustNothing'hashable-1.4.0.2-IlhYX8oPry6K1Nkk5KloojData.Hashable.ClassHashable GHC.UnicodeisSpaceTrue)prettyprinter-1.7.1-BauxLiNvN3EiJKyXe93SMPrettyprinter.Internal