úÎ!¸3³MU      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTSafe 7=?HVmY core-text\Conversion 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  ByteString underlying the Bytes type. core-textOutput the content of the  to the specified U.  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:   (intoRope b) Pon 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    yAt 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/7=?@AMmiU core-textWMachinery to interpret a type as containing valid Unicode that can be represented as a Rope object.Implementation notes Given that Rope is backed by a finger tree, appendÿ± 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 ByteString 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  ByteStringD instance requires that its content be valid UTF-8. If not an empty Rope 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 RopeO. The default implementation is basically a convenience wrapper around calling  and Vping it to your text (which will work just fine, but for some types more efficient implementations are possible). core-textThe length of the RopeU, in characters. This is the monoid used to structure the finger tree underlying the Rope. core-text’A 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 data¢Often 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 librarieslThe 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 Z 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 out€This 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-textAn 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-text+Get the length of this text, in characters. 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,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-textIf you knowm 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 U. import  Core.Text import  Core.System> -- re-exports stdout main :: IO () main = let text :: # text = "Hello World" in     text because it's tradition.Uses d 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  Yhttps://hackage.haskell.org/package/core-program/docs/Core-Program-Execute.html#t:ProgramProgram monad, then  Whttps://hackage.haskell.org/package/core-program/docs/Core-Program-Logging.html#v:writewrite& 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 !D '\n' text then handleComplexCase else keepItSimple - core-textfrom  Data.String 0 core-textfrom Data.ByteString.Lazy 1 core-textfrom Data.ByteString Strict 2 core-textfrom Data.Text.Lazy 3 core-textfrom  Data.Text Strict 4 core-textfrom Data.Text.Short  !! Nonew­> core-text‚Split 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 W. Examples: »> breakWords "This is a test" ["This","is","a","test"] »> +breakWords ("St" <> "op and " <> "go left") ["Stop","and","go","left"] »> breakWords emptyRope [] ? core-textpSplit a paragraph of text into a list of its individual lines. The paragraph will be broken wherever there is a '\n' character.BBlank lines will be preserved. Note that as a special case you do notJ get a blank entry at the end of the a list of newline terminated strings. »> breakLines "Hello\n\nWorld\n" ["Hello","","World"] @ core-textHBreak a Rope into pieces whereever the given predicate function returns Truei. If found, that character will not be included on either side. Empty runs, however, *will* be preserved.>?@ABNone =?HVXk±Ù C core-text•Types which can be rendered "prettily", that is, formatted by a pretty printer and embossed with beautiful ANSI colours when printed to the terminal.Use H' to build text object for later use or  Ohttps://hackage.haskell.org/package/core-program/docs/Core-Program-Logging.htmlControl.Program.Logging's  Xhttps://hackage.haskell.org/package/core-program/docs/Core-Program-Logging.html#v:writeRwriteR+ if you're writing directly to console now.D core-textDWhich type are the annotations of your Doc going to be expressed in?E core-text6Convert semantic tokens to specific ANSI escape tokensF core-textArrange your type as a X ann&, annotated with your semantic tokens.H core-text!Given an object of a type with a C– instance, transform it into a Rope saturated with ANSI escape codes representing syntax highlighting or similar colouring, wrapping at the specified width.cThe obvious expectation is that the next thing you're going to do is send the Rope to console with:   (H 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.I core-textxHaving gone to all the trouble to colourize your rendered types... sometimes you don't want that. This function is like Ha, but removes all the ANSI escape codes so it comes outformatted but as plain black & white text.J core-textbRender "a" or "an" in front of a word depending on English's idea of whether it's a vowel or not.K core-text÷Often 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.M core-text¦Pad a pieve 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 leftPadA which has a glorious place in the history of the world-wide web.N core-text.Right pad a text with the specified character.O core-textMulti-line string literals.$To use these you need to enable the  QuasiQuotes( language extension in your source file: @{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE QuasiQuotes #-} Iyou 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 = [O±| 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 X­ 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 = [Ol| If the sun rises in the west you drank too much last week. |] kLeading whitespace from the first line and trailing whitespace from the last line will be trimmed, so this:  let value = [O| Hello |] is translated to:  let value =  "Hello\n" wwithout 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 [O| ... |] literal.>?@ABCDEFGHIJKLMNOCDEFHIJ>?@KLMNOABGNone² * !>?@ABCDEFGHIJKLMNOY !"#$%&'()*+,-./01223456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrsqtuqvwxyz{(core-text-0.2.2.2-6i3YDFhtl3x9Cv6ru0XwE3Core.Text.BytesCore.Text.RopeCore.Text.UtilitiesCore.Program.ExecuteoutputProgramwriteCore.System.BasewithFileReadModeData.Semigroup<> System.IOstdoutData.ByteString.Builder hPutBuilderData.Text.Short ShortTextData.ByteString.ShortShortByteStringBuilderHandle'Core.Text.BreakingwriteR Data.String fromStringIsString Core.TextBinary fromBytes intoBytesBytesunByteshOutputhInput$fHashableBytes $fBinary[]$fBinaryBuilder$fBinaryByteString$fBinaryByteString0 $fBinaryBytes $fShowBytes $fEqBytes $fOrdBytes$fGenericBytesTextualfromRopeintoRope appendRopeWidthRopeunRope emptyRope singletonRope widthRopenullRope splitRope insertRopeunsafeIntoRopehWritecontainsCharacter $fMonoidWidth$fSemigroupWidth$fMeasuredWidthShortText$fHashableRope $fMonoidRope$fSemigroupRope$fIsStringRope $fPrettyRope $fOrdRope$fEqRope $fNFDataRope $fTextual[] $fBinaryRope$fTextualBytes$fTextualByteString$fTextualByteString0 $fTextualText$fTextualText0$fTextualShortText $fTextualRope$fTextualFingerTree $fShowRope $fEqWidth $fOrdWidth $fShowWidth $fNumWidth$fGenericWidth $fGenericRope breakWords breakLines breakPieces intoPieces intoChunksRenderToken colourizeintoDocA byteChunkrender renderNoAnsi indefinitewrap underline leftPadWith rightPadWithquote $fRenderBytes $fRenderText $fRender[] $fRenderChar $fRenderRopebaseGHC.IO.Handle.TypesHandleGHC.Basemappend GHC.UnicodeisSpace*prettyprinter-1.5.1-Cj1hBNl4uRELsOLXmnSkK3"Data.Text.Prettyprint.Doc.InternalDoc