h,*      !"#$%&'()*+,-./0123 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b cdefghijklmnopqrstuvwxyz{|}~                     !!!!!!"""#####"""####$%%%%%%%%&&&&&&&&&&&&&&&&&&&&"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""''''''((((())))))))))))*********+++++++++,,--..........////////////0000000000016%(c) 2009, 2010, 2011 Bryan O'Sullivan BSD-stylebos@serpentine.comportableNone %& ,Mutable array type, for use in the ST monad. Immutable array type. &Create an uninitialized mutable array. text-Create an uninitialized mutable pinned array. texttext*Freeze a mutable array. Do not mutate the   afterwards!Unchecked read of an immutable array. May return garbage or crash on an out-of-bounds access.textUnchecked write of a mutable array. May return garbage or crash on an out-of-bounds access.%Convert an immutable array to a list.An empty immutable array.Run an action in the ST monad and return an immutable array of its result.Run an action in the ST monad and return an immutable array of its result paired with whatever else the action returns.texttext&Copy some elements of a mutable array.)Copy some elements of an immutable array.textCopy from pointer.textCopy to pointer.Compare portions of two arrays for equality. No bounds checking is performed.textCompare portions of two arrays. No bounds checking is performed. DestinationDestination offsetSource Source offsetCountCount DestinationDestination offsetSource Source offset DestinationDestination offsetSourceCountSource Source offset DestinationCountFirstOffset into firstSecondOffset into secondCount     (c) Bryan O'Sullivan 2009 BSD-stylebos@serpentine.comGHCSafe} ;An exception type for representing Unicode encoding errors. Could not decode a byte sequence because it was invalid under the given encoding, or ran out of input in mid-decode.!Tried to encode a character that could not be represented under the given encoding, or ran out of input in mid-encode." A handler for an encoding error.#A handler for a decoding error.$Function type for handling a coding error. It is supplied with two inputs:A  that describes the error.The input value that caused the error. If the error arose because the end of input was reached or could not be identified precisely, this value will be .,If the handler returns a value wrapped with , that value will be used in the output as the replacement for the invalid input. If it returns &, no value will be used in the output.;Should the handler need to abort processing, it should use  or  an exception (preferably a ). It may use the description provided to construct a more helpful error report.%Throw a  if decoding fails.&Replace an invalid input byte with the Unicode replacement character U+FFFD.'Throw a  if encoding fails.(?@ABCDEFGHIJ=>KLM789:;= 2, otherwise nindex causes access violationSubstring to search for (needle)Text to search in (haystack)7None 1FThe input buffer (src :: ByteArray#, off :: CSize, len :: CSize) must specify a valid UTF-8 sequence, this condition is not checked.O(n)6 Reverse the characters of a string. Assume that the Text is non-empty. The returned Text is guaranteed to be non-empty.(c) Roman Leshchinskiy 2008, (c) Bryan O'Sullivan 2009 BSD-stylebos@serpentine.com experimentalportableNone3 ,A size in UTF-8 code units (which is bytes).Lower and upper bounds on size. Unknown size.The  of the given code point.The  of n code points.Minimum of two size hints.Maximum of two size hints.7Compute the maximum size from a size hint, if possible.7Compute the minimum size from a size hint, if possible.0Determine the ordering relationship between two s, or  in the indeterminate case.(c) Tom Harper 2008-2009, (c) Bryan O'Sullivan 2009, (c) Duncan Coutts 2009, (c) Jasper Van der Jeugt 2011 BSD-stylebos@serpentine.com experimentalGHCNone6VA co-recursive type yielding a single element at a time depending on the internal state it carries.-Intermediate result in a processing pipeline.!An intermediate result in a scan. Strict pair.Restreaming state.&Specialised tuple for case conversion.O(n)% Determines if two streams are equal.The empty stream.8(c) Bryan O'Sullivan 2009, 2012 BSD-stylebos@serpentine.com experimentalGHCNoned>8Strict triple.O(1) Convert a character into a  Properties 9 .  = :O(n) Convert a list into a . Properties 9 .  = ;O(n) Convert a  into a list. Properties  . < = 5Stream the UTF-8-like packed encoding used by GHC to represent constant strings in generated code.This encoding uses the byte sequence "xc0x80" to represent NUL, and the string is NUL-terminated. Properties  9 .  addr# = => addr#O(n)0 Adds a character to the front of a Stream Char. Properties  9 .  c . < = ? cO(n)) Adds a character to the end of a stream. Properties  9 .  c . < = @ cO(n)! Appends one Stream to the other. Properties  9 ( (< t1) (< t2)) = A t1 t2O(1)" Returns the first character of a  , which must be non-empty. This is a partial function, consider using . Properties   . < = BO(1)0 Returns the first character and remainder of a  , or  if empty. Properties  CD EF .  . < = CD EF . G  CD (9 . EH) .  . < = CD EH . GO(n)! Returns the last character of a  , which must be non-empty. Properties   . < = IO(1), Returns all characters after the head of a  , which must be non-empty. This is a partial function, consider using . Properties  9 .  . < = JO(1)) Returns all but the last character of a  , which must be non-empty. Properties  9 .  . < = KO(1) Tests whether a   is empty or not. Properties   . < = LO(n). Returns the number of characters in a string.O(n): Compares the count of characters in a string to a number.This function gives the same answer as comparing against the result of , but can short circuit if the count of characters is greater than the number or if the stream can't possibly be as long as the number supplied, and hence be more efficient.O(n)8 Indicate whether a string contains exactly one element. Properties   . < = MO(n)  f  xs is the   obtained by applying f to each element of xs. Properties  9 .  f . < = N fO(n) Take a character and place it between each of the characters of a 'Stream Char'. Properties  9 .  c . < = O cMap a ) through the given case-mapping function.O(n) Convert a string to folded case. This function is mainly useful for performing caseless (or case insensitive) string comparisons. A string x" is a caseless match for a string y if and only if:  x ==  yThe result string may be longer than the input string, and may differ from applying  to the input string. For instance, the Armenian small ligature men now (U+FB13) is case folded to the bigram men now (U+0574 U+0576), while the micro sign (U+00B5) is case folded to the Greek small letter letter mu (U+03BC) instead of itself.O(n) Convert a string to upper case, using simple case conversion. The result string may be longer than the input string. For instance, the German eszett (U+00DF) maps to the two-letter sequence SS. Properties  9 .  . < = PO(n) Convert a string to lower case, using simple case conversion. The result string may be longer than the input string. For instance, the Latin capital letter I with dot above (U+0130) maps to the sequence Latin small letter i (U+0069) followed by combining dot above (U+0307). Properties  9 .  . < = QO(n)? Convert a string to title case, using simple case conversion.#The first letter (as determined by 3R) of the input is converted to title case, as is every subsequent letter that immediately follows a non-letter. Every letter that immediately follows another letter is converted to lower case.The result string may be longer than the input string. For example, the Latin small ligature  (U+FB02) is converted to the sequence Latin capital letter F (U+0046) followed by Latin small letter l (U+006C).=This function is not idempotent. Consider lower-case letter = (U+0149 LATIN SMALL LETTER N PRECEDED BY APOSTROPHE). Then ST "" = "N": the first (and the only) letter of the input is converted to title case, becoming two letters. Now  (U+02BC MODIFIER LETTER APOSTROPHE) is a modifier letter and as such is recognised as a letter by 3R, so ST "N" = "'n".Note: this function does not take language or culture specific rules into account. For instance, in English, different style guides disagree on whether the book name "The Hill of the Red Fox" is correctly title cased@but this function will capitalize every word. Properties  9 .  . < = Tfoldl, applied to a binary operator, a starting value (typically the left-identity of the operator), and a , reduces the 0 using the binary operator, from left to right. Properties   f z0 . < = U f z0A strict version of foldl. Properties   f z0 . < = V f z0foldl1 is a variant of foldl that has no starting value argument, and thus must be applied to non-empty Streams. Properties   f . < = W fA strict version of foldl1. Properties   f . < = X fA monadic version of . Properties   f z0 . < = Y f z0, applied to a binary operator, a starting value (typically the right-identity of the operator), and a stream, reduces the stream using the binary operator, from right to left. Properties   f z0 . < = Z f z0foldr1 is a variant of  that has no starting value argument, and thus must be applied to non-empty streams. Properties   f . < = [ fintercalate str strs inserts the stream str in between the streams strs and concatenates the result. Properties   s =  . \O sO(n) Concatenate a list of streams. Properties 9 .  . CD < = ]Map a function over a stream that results in a stream and concatenate the results. Properties 9 .  (^< . f) . < = _ fO(n) any p .xs determines if any character in the stream xs satisfies the predicate p. Properties  f . ^< = ` fO(n) all p 'xs determines if all characters in the Text xs satisfy the predicate p. Properties  f . ^< = a fO(n) maximum returns the maximum value from a stream, which must be non-empty. Properties  . ^< = bO(n)* minimum returns the minimum value from a Text, which must be non-empty. Properties  . ^< = cO(n)  is similar to , but returns a stream of successive reduced values from the left. Conceptually, if we write the input stream as a list then we have: scanl f z [x1, x2, ...] == [z, z 'f' x1, (z 'f' x1) 'f' x2, ...] Properties  ( f z xs) = z  ( f z xs) =  f z xsO(n)  n c is a   of length n with c the value of every element.O(n*m)  n t is a   consisting of the input t repeated n times.O(n), where n is the length of the result. The unfoldr function is analogous to the List . unfoldr builds a stream from a seed value. The function takes the element and returns Nothing if it is done producing the stream or returns Just (a,b), in which case, a is the next Char in the string, and b is the seed value for further production. Properties 9 .  f z = d f zO(n) Like ,  builds a stream from a seed value. However, the length of the result is limited by the first argument to (. This function is more efficient than ( when the length of the result is known. Properties 9 ( n f z) = e n f zO(n)  n, applied to a stream, returns the prefix of the stream of length n, or the stream itself if n+ is greater than the length of the stream. Properties 9 .  n . < = f nO(n)  n, applied to a stream, returns the suffix of the stream after the first n$ characters, or the empty stream if n+ is greater than the length of the stream. Properties 9 .  n . < = g n, applied to a predicate p and a stream, returns the longest prefix (possibly empty) of elements that satisfy p. Properties 9 .  p . < = h p p xs$ returns the suffix remaining after  p xs. Properties 9 .  p . < = i pO(n) The  function takes two s and returns 4 if and only if the first is a prefix of the second. Properties   (< t1) (< t2) = j t1 t2O(n) $ is the stream membership predicate. Properties   c . < = k cO(n) The  function takes a predicate and a stream, and returns the first element in matching the predicate, or  if there is no such element. Properties   p . < = l pO(n)4 Stream index (subscript) operator, starting from 0. Properties   (< t) n = m t nO(n) , applied to a predicate and a stream, returns a stream containing those characters that satisfy the predicate. Properties  9 .  p . < = n pThe  function takes a predicate and a stream and returns the index of the first element in the stream satisfying the predicate. Properties  p . < = o pThe  function takes a predicate and a stream and returns all indices of the elements in the stream satisfying the predicate.zipWith generalises zip by zipping with the function given as the first argument, instead of a tupling function. Properties  9 ( f (< t1) (< t2)) = p f t1 t2O(n) The  function returns the number of times the query element appears in the given stream. Properties  c . < = q c66BSD-style (see LICENSE) experimental Trustworthy (wtextPrefix of a UTF-8 code point encoded in 4 bytes, possibly empty.The most significant byte contains the number of bytes, between 0 and 3.3The remaining bytes hold the incomplete code point.Unused bytes must be 0.All of operations available on it are the functions below. The constructor should never be used outside of those.textState of decoding a * in UTF-8. Enables incremental decoding (, , , ).6Bytes of the currently incomplete code point (if any).!State of the UTF-8 state machine.textUse y to build l.textCopy l in a ytextInitial . Empty prefix.Length of the partial code point, stored in the most significant byte.Length of the code point once completed (it is known in the first byte). 0 if empty.Get the n(-th byte, assuming it is within bounds: 0 <= n < partUtf8Len c.Unsafe: no bounds checking.Append some bytes.Unsafe: no bounds checking.Fold a >. This avoids recursion so it can unfold to straightline code.Convert  to .Exported for testing.Exported for testing. Validate a . as UTF-8-encoded text. To be continued using . See also , for details on the result of this function.  =    PropertiesGiven:  chunk = (n, ms) The prefix is valid UTF-8. In particular, it should be accepted by this validation:  (rf n chunk) = (n, Just ) Validate another 2 chunk in an ongoing stream of UTF-8-encoded text.Returns a pair: The first component n is the end position, relative to the current chunk, of the longest prefix of the accumulated bytestring which is valid UTF-8. n may be negative: that happens when an incomplete code point started in a previous chunk and is not completed by the current chunk (either that code point is still incomplete, or it is broken by an invalid byte).The second component ms indicates the following:if  ms = Nothing, the remainder of the chunk contains an invalid byte, within four bytes from position n;if  ms = Just s'9, you can carry on validating another chunk by calling  with the new state s'. PropertiesGiven:  s chunk = (n, ms) ;If the chunk is invalid, it cannot be extended to be valid. ms = Nothing ==>  s (chunk  more) = (n, Nothing) Validating two chunks sequentially is the same as validating them together at once: ms = Just s' ==>  s (chunk  more) = st (ru chunk ) ( s' more) 0Decode another chunk in an ongoing UTF-8 stream.Returns a triple: A y for the decoded chunk of text. You can accumulate chunks with () or output them with vw.The undecoded remainder of the given chunk, for diagnosing errors and resuming (presumably after skipping some bytes). the new state, or  if an invalid byte was encountered (it will be within the first 4 bytes of the undecoded remainder). PropertiesGiven: (pre, suf, ms) =  s chunk If the output pre is nonempty (alternatively, if length chunk > length suf)  s2b pre `rA` suf = p2b s `rA` chunk where s2b = x . w p2b = y If the output pre is empty (alternatively, if length chunk = length suf)  suf = chunkDecoding chunks separately is equivalent to decoding their concatenation.Given: (pre1, suf1, Just s1) = " s chunk1 (pre2, suf2, ms2) = # s1 chunk2 (pre3, suf3, ms3) =  s (chunk1 `B.append` chunk2) we have:  s2b (pre1  pre2) = s2b pre3 ms2 = ms3 text3Decode a chunk of UTF-8 text. To be continued with .See  for details on the result. Properties  =   Given:  chunk = (builder, rest, ms) builder is a prefix and rest is a suffix of chunk. x (z builder)  rest = chunk textCall the error handler on each byte of the partial code point stored in  and append the results.Exported for use in lazy &{.text Helper for {.text Helper for {, | , and lazy &{, which use an # to process bad bytes.See ! for a more flexible alternative.yzzyNonexNative implementation of }.Native implementation of ~ and .BytesOffsetLengthNone }1.Is the ByteString a valid UTF-8 byte sequence?For pinned byte arrays larger than 128KiB, this switches to the safe FFI so that it does not prevent GC. This threshold (128KiB) was chosen somewhat arbitrarily and may change in the future.This uses the unsafe FFI. GC waits for all unsafe: FFI calls to complete before starting. Consequently, an unsafe FFI call does not run concurrently with GC and is not interrupted by GC. Since relocation cannot happen concurrently with an unsafe FFI call, it is safe to call this function with an unpinned byte array argument. It is also safe to call this with a pinned  ByteArray argument.This uses the safe# FFI. GC may run concurrently with safe FFI calls. Consequently, unpinned objects may be relocated while a safe0 FFI call is executing. The byte array argument must be pinned, and the calling context is responsible for enforcing this. If the byte array is not pinned, this function's behavior is undefined.BytesOffsetLengthBytesOffsetLengthBytesOffsetLength%(c) 2009, 2010, 2011 Bryan O'Sullivan BSD-stylebos@serpentine.comportableNoneL O(1) A variant of  for non-empty l.  omits the check for the empty case, so there is an obligation on the programmer to provide a proof that the l is non-empty.O(1) A variant of  for non-empty l.  omits the check for the empty case, so there is an obligation on the programmer to provide a proof that the l is non-empty.O(1) Iterate (unsafely) one step forwards through a UTF-8 array, returning the current character and the delta to add to give the next offset to iterate at.textO(1) Iterate one step through a UTF-8 array, returning the delta to add to give the next offset to iterate at.O(1) Iterate one step backwards through a UTF-8 array, returning the current character and the delta to add (i.e. a negative number) to give the next offset to iterate at.texttextO(1) Iterate one step backwards through a UTF-8 array, returning the delta to add (i.e. a negative number) to give the next offset to iterate at.textO(1) Return the length of a l in units of Word8. This is useful for sizing a target array appropriately before using unsafeCopyToPtr.textO(1) Unchecked take of k Word8s from the front of a l.textO(1) Unchecked drop of k Word8s from the front of a l.dcdc=(c) 2009-2015 Bryan O'Sullivan BSD-stylebos@serpentine.com experimentalGHC Trustworthy (O(n) Convert a l into a .textO(n) Convert a null-terminated  2https://en.wikipedia.org/wiki/UTF-8#Modified_UTF-8modified UTF-8 (but with a standard UTF-8 representation of characters from supplementary planes) string to a l. Counterpart to . No validation is performed, malformed input can lead to memory access violation.textO(n)- Convert a null-terminated ASCII string to a l. Counterpart to >. No validation is performed, malformed input can lead to memory access violation.O(1) Convert a character into a Text. Performs replacement on invalid scalar values.(c) 2008, 2009 Tom Harper, (c) 2009, 2010 Bryan O'Sullivan, (c) 2009 Duncan Coutts BSD-stylebos@serpentine.com experimentalGHC Trustworthy O(n) map f t is the l obtained by applying f to each element of t. Assume that the Text is non-empty. The returned Text is guaranteed to be non-empty.O(n)3 Convert a string to folded case. Assume that the Text is non-empty. The returned Text is guaranteed to be non-empty.O(n) Convert a string to lower case, using simple case conversion. Assume that the Text is non-empty. The returned Text is guaranteed to be non-empty.O(n) Convert a string to upper case, using simple case conversion. Assume that the Text is non-empty. The returned Text is guaranteed to be non-empty.O(n)% Convert a string to title case, see T" for discussion. Assume that the Text is non-empty. The returned Text is guaranteed to be non-empty.O(n) /, applied to a continuation, a predicate and a Text#, calls the continuation with the Text9 containing only the characters satisfying the predicate.(c) 2011 Bryan O'Sullivan BSD-stylebos@serpentine.com experimentalGHCNonetextFor the sake of performance this function does not check that a char is in ASCII range; it is a responsibility of p.(c) Tom Harper 2008-2009, (c) Bryan O'Sullivan 2009-2010, (c) Duncan Coutts 2009 BSD-stylebos@serpentine.com experimentalGHCNoneW O(n) Convert l into a  . Properties  .  =   .  = textO(n)  t =  (t <> '\n')Shared implementation of  and .O(n) Converts l into a  +, but iterates backwards through the text. Properties  .  = O(n) Convert   into a l. Properties  .  =   .  = O(n)' Returns the number of characters in a . Properties  .  = uO(n) Reverse the characters of a  returning l. Properties  .  = O(n) Perform the equivalent of scanr7 over a list, only with the input and result reversed. Properties  .  f c .  =  f cO(n) Like unfoldr,  builds a stream from a seed value. However, the length of the result is limited by the first argument to (. This function is more efficient than unfoldr( when the length of the result is known. Properties  ( n f a) = e n f aO(n)4 stream index (subscript) operator, starting from 0. Properties  ( t) n = m t nThe  function takes a predicate and a stream and returns the index of the first element in the stream satisfying the predicate. Properties  p .  = o pO(n) The count function returns the number of times the query element appears in the given stream. Properties  c .  = q cO(n) Like a combination of map and foldl'+. Applies a function to each element of a l, passing an accumulating parameter from left to right, and returns a final l. Properties  g z0 .  =  g z0(c) Tom Harper 2008-2009, (c) Bryan O'Sullivan 2009, (c) Duncan Coutts 2009, (c) Jasper Van der Jeugt 2011 BSD-stylebos@serpentine.com experimentalportableNone(c) 2009, 2010 Bryan O'Sullivan BSD-stylebos@serpentine.com experimentalportableNoneRO(n) Convert a lazy - into a 'Stream Char', using UTF-8 encoding.O(n) Convert a < into a 'Stream Char', using little endian UTF-16 encoding.O(n) Convert a 9 into a 'Stream Char', using big endian UTF-16 encoding.O(n) Convert a 9 into a 'Stream Char', using big endian UTF-32 encoding.O(n) Convert a < into a 'Stream Char', using little endian UTF-32 encoding.O(n) Convert a   to a lazy .O(n) Convert a   to a lazy . None textO(n) Test whether l contains only ASCII code-points (i.e. only U+0000 through U+007F).$This is a more efficient version of all 3. isAscii ""TrueisAscii "abc\NUL"TrueisAscii "abcdA"FalseisAscii t == all (< '\x80') t#Length of the longest ASCII prefix.(c) Tom Harper 2008-2009, (c) Bryan O'Sullivan 2009, (c) Duncan Coutts 2009 BSD-stylebos@serpentine.com experimentalportableNoneO(n) Convert a - into a 'Stream Char', using UTF-8 encoding.O(n) Convert a < into a 'Stream Char', using little endian UTF-16 encoding.O(n) Convert a 9 into a 'Stream Char', using big endian UTF-16 encoding.O(n) Convert a 9 into a 'Stream Char', using big endian UTF-32 encoding.O(n) Convert a < into a 'Stream Char', using little endian UTF-32 encoding.O(n) Convert a   to a . (c) 2009, 2010, 2011 Bryan O'Sullivan, (c) 2009 Duncan Coutts, (c) 2008, 2009 Tom Harper (c) 2021 Andrew Lelechenko BSD-stylebos@serpentine.comportable Trustworthy atext"A stream oriented decoding result.text Decode a  containing ASCII text.This is a total function which returns a pair of the longest ASCII prefix as l, and the remaining suffix as .Important note: the pair is lazy. This lets you check for errors by testing whether the second component is empty, without forcing the first component (which does a copy). To drop references to the input bytestring, force the prefix (using  or  BangPatterns$) and drop references to the suffix. PropertiesIf &(prefix, suffix) = decodeAsciiPrefix s, then  prefix <> suffix = s.Either suffix is empty, or B suffix > 127.text Decode a % containing 7-bit ASCII encoded text.2This is a total function which returns either the  converted to a l containing ASCII text, or .Use  to retain the longest ASCII prefix for an invalid input instead of discarding it. Decode a % containing 7-bit ASCII encoded text.This is a partial function: it checks that input does not contain anything except ASCII and copies buffer or throws an error otherwise. Decode a 2 containing Latin-1 (aka ISO-8859-1) encoded text.! is semantically equivalent to -Data.Text.pack . Data.ByteString.Char8.unpackThis is a total function. However, bear in mind that decoding Latin-1 (non-ASCII) characters to UTf-8 requires actual work and is not just buffer copying.text$Decode, in a stream oriented way, a : containing UTF-8 encoded text that is known to be valid.If the input contains any invalid UTF-8 data, an exception will be thrown (either by this function or a continuation) that cannot be caught in pure code. For more control over the handling of invalid data, use .text)Decode, in a stream oriented way, a lazy  containing UTF-8 encoded text. Decode a  containing UTF-8 encoded text.;Surrogate code points in replacement character returned by #9 will be automatically remapped to the replacement char U+FFFD. Decode a : containing UTF-8 encoded text that is known to be valid.If the input contains any invalid UTF-8 data, an exception will be thrown that cannot be caught in pure code. For more control over the handling of invalid data, use  or .This is a partial function: it checks that input is a well-formed UTF-8 sequence and copies buffer or throws an error otherwise. Decode a  containing UTF-8 encoded text.If the input contains any invalid UTF-8 data, the relevant exception will be returned, otherwise the decoded text.text Decode a  containing UTF-8 encoded text.Any invalid input bytes will be replaced with the Unicode replacement character U+FFFD.textEncode text to a ByteString  using UTF-8 encoding.textEncode text using UTF-8 encoding and escape the ASCII characters using a .Use this function is to implement efficient encoders for text-based formats like JSON or HTML.!Encode text using UTF-8 encoding./Decode text from little endian UTF-16 encoding./Decode text from little endian UTF-16 encoding.If the input contains any invalid little endian UTF-16 data, an exception will be thrown. For more control over the handling of invalid data, use .,Decode text from big endian UTF-16 encoding.,Decode text from big endian UTF-16 encoding.If the input contains any invalid big endian UTF-16 data, an exception will be thrown. For more control over the handling of invalid data, use .0Encode text using little endian UTF-16 encoding.-Encode text using big endian UTF-16 encoding./Decode text from little endian UTF-32 encoding./Decode text from little endian UTF-32 encoding.If the input contains any invalid little endian UTF-32 data, an exception will be thrown. For more control over the handling of invalid data, use .,Decode text from big endian UTF-32 encoding.,Decode text from big endian UTF-32 encoding.If the input contains any invalid big endian UTF-32 data, an exception will be thrown. For more control over the handling of invalid data, use .0Encode text using little endian UTF-32 encoding.-Encode text using big endian UTF-32 encoding.%yz%yz (c) 2009, 2010 Bryan O'Sullivan BSD-stylebos@serpentine.comGHCNone text1A type representing a number of UTF-8 code units.O(n) Create a new l from a  ' by copying the contents of the array.textO(n) Create a new l from a  6 by copying the contents of the NUL-terminated array.textO(1) Return the prefix of the l of n  units in length.If n would cause the l to end inside a code point, the end of the prefix will be advanced by several additional ! units to maintain its validity.textO(1) Return the suffix of the l, with n # units dropped from its beginning.If n would cause the l to begin inside a code point, the beginning of the suffix will be advanced by several additional  unit to maintain its validity.O(n) Copy a l to an array. The array is assumed to be big enough to hold the contents of the entire l.O(n)6 Perform an action on a temporary, mutable copy of a l3. The copy is freed as soon as the action returns.O(n) Make a mutable copy of a l.text Marshal a l into a C string with a trailing NUL byte, encoded as UTF-8 in temporary storage.The l itself must not contain any NUL bytes, this precondition is not checked. Cf. .The temporary storage is freed when the subcomputation terminates (either normally or via an exception), so the pointer to the temporary storage must not% be used after this function returns.textO(n) Decode a C string with explicit length, which is assumed to have been encoded as UTF-8. If decoding fails, a UnicodeException is thrown.textO(n) Decode a null-terminated C string, which is assumed to have been encoded as UTF-8. If decoding fails, a UnicodeException is thrown.text Marshal a l into a C string encoded as UTF-8 in temporary storage, with explicit length information. The encoded string may contain NUL bytes, and is not followed by a trailing NUL byte.The temporary storage is freed when the subcomputation terminates (either normally or via an exception), so the pointer to the temporary storage must not% be used after this function returns. source arraylength of source array (in  units) source array  (c) 2009, 2010, 2011, 2012 Bryan O'Sullivan, (c) 2009 Duncan Coutts, (c) 2008, 2009 Tom Harper (c) 2021 Andrew Lelechenko BSD-stylebos@serpentine.comGHC Trustworthy (text"Bidirectional pattern synonym for  (O(n)) and  (O(1)) to be used together with .text"Bidirectional pattern synonym for  (O(n)) and  (O(1)), to be used together with .text"Bidirectional pattern synonym for n and  (both O(1)), to be used together with  or .O(n) Compare two l values lexicographically.O(n)$ Adds a character to the front of a l*. This function is more costly than its List counterpart because it requires copying a new array. Performs replacement on invalid scalar values.O(n)" Adds a character to the end of a l. This copies the entire array in the process. Performs replacement on invalid scalar values.O(1)" Returns the first character of a l, which must be non-empty. This is a partial function, consider using  instead.O(1)+ Returns the first character and rest of a l, or  if empty.O(1)! Returns the last character of a l, which must be non-empty. This is a partial function, consider using  instead.O(1), Returns all characters after the head of a l, which must be non-empty. This is a partial function, consider using  instead.O(1)) Returns all but the last character of a l, which must be non-empty. This is a partial function, consider using  instead.textO(1) Returns all but the last character and the last character of a l, or  if empty.O(1) Tests whether a l is empty or not.O(1) Tests whether a l contains exactly one character.O(n)' Returns the number of characters in a l. O(min(n,c))& Compare the count of characters in a l to a number.  t c =  ( t) c This function gives the same answer as comparing against the result of , but can short circuit if the count of characters is greater than the number, and hence be more efficient.O(n)  f t is the l obtained by applying f to each element of t.Example:0let message = pack "I am not angry. Not at all."1T.map (\c -> if c == '.' then '!' else c) message"I am not angry! Not at all!".Performs replacement on invalid scalar values.O(n) The  function takes a l and a list of ls and concatenates the list after interspersing the first argument between each element of the list.Example::T.intercalate "NI!" ["We", "seek", "the", "Holy", "Grail"] "WeNI!seekNI!theNI!HolyNI!Grail"O(n) The  function takes a character and places it between the characters of a l.Example:T.intersperse '.' "SHIELD" "S.H.I.E.L.D".Performs replacement on invalid scalar values.O(m+n)- Replace every non-overlapping occurrence of needle in haystack with  replacement.:This function behaves as though it was defined as follows: (replace needle replacement haystack =  replacement ( needle haystack) As this suggests, each occurrence is replaced exactly once. So if needle occurs in  replacement, that occurrence will not! itself be replaced recursively:replace "oo" "foo" "oo""foo"$In cases where several instances of needle/ overlap, only the first one will be replaced:replace "ofo" "bar" "ofofo""barfo"In (unlikely) bad cases, this function's time complexity degrades towards O(n*m).O(n)! Convert a string to folded case.This function is mainly useful for performing caseless (also known as case insensitive) string comparisons. A string x" is a caseless match for a string y if and only if: toCaseFold x == toCaseFold yThe result string may be longer than the input string, and may differ from applying  to the input string. For instance, the Armenian small ligature "" (men now, U+FB13) is case folded to the sequence " " (men, U+0574) followed by " " (now, U+0576), while the Greek "" (micro sign, U+00B5) is case folded to "" (small letter mu, U+03BC) instead of itself.O(n)? Convert a string to lower case, using simple case conversion.The result string may be longer than the input string. For instance, "" (Latin capital letter I with dot above, U+0130) maps to the sequence "i" (Latin small letter i, U+0069) followed by " " (combining dot above, U+0307).O(n)? Convert a string to upper case, using simple case conversion.The result string may be longer than the input string. For instance, the German "" (eszett, U+00DF) maps to the two-letter sequence "SS".textO(n)? Convert a string to title case, using simple case conversion.#The first letter (as determined by 3R) of the input is converted to title case, as is every subsequent letter that immediately follows a non-letter. Every letter that immediately follows another letter is converted to lower case.=This function is not idempotent. Consider lower-case letter = (U+0149 LATIN SMALL LETTER N PRECEDED BY APOSTROPHE). Then ST "" = "N": the first (and the only) letter of the input is converted to title case, becoming two letters. Now  (U+02BC MODIFIER LETTER APOSTROPHE) is a modifier letter and as such is recognised as a letter by 3R, so ST "N" = "'n".The result string may be longer than the input string. For example, the Latin small ligature  (U+FB02) is converted to the sequence Latin capital letter F (U+0046) followed by Latin small letter l (U+006C).Note: this function does not take language or culture specific rules into account. For instance, in English, different style guides disagree on whether the book name "The Hill of the Red Fox" is correctly title cased@but this function will capitalize every word.O(n) Left-justify a string to the given length, using the specified fill character on the right. Performs replacement on invalid scalar values. Examples:justifyLeft 7 'x' "foo" "fooxxxx"justifyLeft 3 'x' "foobar""foobar"O(n) Right-justify a string to the given length, using the specified fill character on the left. Performs replacement on invalid scalar values. Examples:justifyRight 7 'x' "bar" "xxxxbar"justifyRight 3 'x' "foobar""foobar"O(n) Center a string to the given length, using the specified fill character on either side. Performs replacement on invalid scalar values. Examples:center 8 'x' "HS" "xxxHSxxx"O(n) The 2 function transposes the rows and columns of its l) argument. Note that this function uses x, , and the list version of transpose, and is thus not very efficient. Examples:transpose ["green","orange"]["go","rr","ea","en","ng","e"]transpose ["blue","red"]["br","le","ud","e"]O(n) , applied to a binary operator, a starting value (typically the left-identity of the operator), and a l, reduces the l/ using the binary operator, from left to right.O(n) A strict version of .O(n) A variant of  that has no starting value argument, and thus must be applied to a non-empty l.O(n) A strict version of .textO(n) A monadic version of .O(n) , applied to a binary operator, a starting value (typically the right-identity of the operator), and a l, reduces the l/ using the binary operator, from right to left.=If the binary operator is strict in its second argument, use  instead. is lazy like Z/ for lists: evaluation actually traverses the l0 from left to right, only as far as it needs to. For example,  can be defined with O(1) complexity using : =head :: Text -> Char head = foldr const (error "head empty") Searches from left to right with short-circuiting behavior can also be defined using  (e.g., , , , ).O(n) A variant of  that has no starting value argument, and thus must be applied to a non-empty l.textO(n) A strict version of . evaluates as a right-to-left traversal using constant stack space.O(n) Concatenate a list of ls.O(n) Map a function over a l that results in a l, and concatenate the results.O(n)  p t* determines whether any character in the l t satisfies the predicate p.O(n)  p t+ determines whether all characters in the l t satisfy the predicate p.O(n) " returns the maximum value from a l, which must be non-empty.O(n) " returns the minimum value from a l, which must be non-empty.O(n)  is similar to , but returns a list of successive reduced values from the left. Performs replacement on invalid scalar values. scanl f z [x1, x2, ...] == [z, z `f` x1, (z `f` x1) `f` x2, ...] Properties  ( f z xs) = z  ( f z xs) =  f z xsO(n)  is a variant of  that has no starting value argument. Performs replacement on invalid scalar values. .scanl1 f [x1, x2, ...] == [x1, x1 `f` x2, ...]O(n)  is the right-to-left dual of 2. Performs replacement on invalid scalar values. 1scanr f v == reverse . scanl (flip f) v . reverseO(n)  is a variant of  that has no starting value argument. Performs replacement on invalid scalar values.O(n) Like a combination of  and +. Applies a function to each element of a l, passing an accumulating parameter from left to right, and returns a final l2. Performs replacement on invalid scalar values.The ( function behaves like a combination of  and a strict .; it applies a function to each element of a l, passing an accumulating parameter from right to left, and returning a final value of this accumulator together with the new l1. Performs replacement on invalid scalar values.O(n*m)  n t is a l consisting of the input t repeated n times.O(n)  n c is a l of length n with c the value of every element.O(n), where n" is the length of the result. The $ function is analogous to the List \d.  builds a l from a seed value. The function takes the element and returns  if it is done producing the l , otherwise  (a,b). In this case, a is the next  in the string, and b is the seed value for further production. Performs replacement on invalid scalar values.O(n) Like ,  builds a l from a seed value. However, the length of the result should be limited by the first argument to (. This function is more efficient than  when the maximum length of the result is known and correct, otherwise its performance is similar to 1. Performs replacement on invalid scalar values.O(n)  n, applied to a l, returns the prefix of the l of length n , or the l itself if n) is greater than the length of the Text.textO(n) If t is long enough to contain n characters,  n t9 returns a non-negative number, measuring their size in . Otherwise, if t is shorter, return a non-positive number, which is a negated total count of  available in t. If t is empty or n = 0 , return 0.#This function is used to implement , ,  and > and is useful on its own in streaming and parsing libraries.textO(n)  n t, returns the suffix remaining after taking n characters from the end of t. Examples:takeEnd 3 "foobar""bar"O(n)  n, applied to a l, returns the suffix of the l after the first n characters, or the empty l if n$ is greater than the length of the l.textO(n)  n t. returns the prefix remaining after dropping n characters from the end of t. Examples:dropEnd 3 "foobar""foo"O(n) , applied to a predicate p and a l, returns the longest prefix (possibly empty) of elements that satisfy p.textO(n) , applied to a predicate p and a l, returns the longest suffix (possibly empty) of elements that satisfy p . Examples:takeWhileEnd (=='o') "foo""oo"O(n)  p t% returns the suffix remaining after  p t.O(n)  p t returns the prefix remaining after dropping characters that satisfy the predicate p from the end of t. Examples:dropWhileEnd (=='.') "foo...""foo"O(n)  p t returns the substring remaining after dropping characters that satisfy the predicate p% from both the beginning and end of t.O(n): Remove leading white space from a string. Equivalent to: dropWhile isSpaceO(n); Remove trailing white space from a string. Equivalent to: dropWhileEnd isSpaceO(n) Remove leading and trailing white space from a string. Equivalent to: dropAround isSpaceO(n)  n t4 returns a pair whose first element is a prefix of t of length n, and whose second is the remainder of the string. It is equivalent to ( n t,  n t).O(n) , applied to a predicate p and text t, returns a pair whose first element is the longest prefix (possibly empty) of t of elements that satisfy p1, and whose second is the remainder of the text.T.span (=='0') "000AB" ("000","AB")O(n)  is like , but the prefix returned is over elements that fail the predicate p.T.break (=='c') "180cm" ("180","cm")textO(length of prefix) !, applied to a monadic predicate p , a text t, returns a pair (t1, t2) where t1 is the longest prefix of t whose elements satisfy p, and t2 is the remainder of the text.T.spanM (\c -> state $ \i -> (fromEnum c == i, i+1)) "abcefg" `runState` 97(("abc","efg"),101) is  specialized to : -- for all p :: Char -> Bool  p =  .  ( . p) textO(length of suffix) !, applied to a monadic predicate p , a text t, returns a pair (t1, t2) where t2 is the longest suffix of t whose elements satisfy p, and t1 is the remainder of the text.T.spanEndM (\c -> state $ \i -> (fromEnum c == i, i-1)) "tuvxyz" `runState` 122(("tuv","xyz"),118)  p .  = fmap (s  ) .  p O(n)7 Group characters in a string according to a predicate. Returns the array index (in units of /) at which a character may be found. This is not1 the same as the logical index returned by e.g. .O(n)* Group characters in a string by equality.O(n)* Return all initial segments of the given l, shortest first.textO(n)* Return all initial segments of the given l, shortest first.O(n)( Return all final segments of the given l, longest first.textO(n)( Return all final segments of the given l, longest first.O(m+n) Break a l$ into pieces separated by the first l argument (which cannot be empty), consuming the delimiter. An empty delimiter is invalid, and will cause an error to be raised. Examples:!splitOn "\r\n" "a\r\nb\r\nd\r\ne"["a","b","d","e"] splitOn "aaa" "aaaXaaaXaaaXaaa"["","X","X","X",""]splitOn "x" "x"["",""]and intercalate s . splitOn s == id splitOn (singleton c) == split (==c)(Note: the string s$ to split on above cannot be empty.)In (unlikely) bad cases, this function's time complexity degrades towards O(n*m).O(n) Splits a l into components delimited by separators, where the predicate returns True for a separator element. The resulting components do not contain the separators. Two adjacent separators result in an empty component in the output. eg.split (=='a') "aabbaca"["","","bb","c",""]split (=='a') ""[""]O(n) Splits a l into components of length k. The last element may be shorter than the other chunks, depending on the length of the input. Examples:chunksOf 3 "foobarbaz"["foo","bar","baz"]chunksOf 4 "haskell.org"["hask","ell.","org"]O(n) The " function takes a character and a l, and returns & if the element is found in the given l, or  otherwise.O(n) The " function takes a predicate and a l<, and returns the first element matching the predicate, or  if there is no such element.O(n) The " function takes a predicate and a l, and returns the pair of ls with elements which do and do not satisfy the predicate, respectively; i.e. 1partition p t == (filter p t, filter (not . p) t)O(n) , applied to a predicate and a l , returns a l9 containing those characters that satisfy the predicate.O(n+m) Find the first instance of needle (which must be non-) in haystack=. The first element of the returned tuple is the prefix of haystack before needle. is matched. The second is the remainder of haystack, starting with the match. Examples:breakOn "::" "a::b::c"("a","::b::c")breakOn "/" "foobar" ("foobar","")Laws: append prefix match == haystack where (prefix, match) = breakOn needle haystackIf you need to break a string by a substring repeatedly (e.g. you want to break on every instance of a substring), use , instead, as it has lower startup overhead.In (unlikely) bad cases, this function's time complexity degrades towards O(n*m).O(n+m) Similar to +, but searches from the end of the string.9The first element of the returned tuple is the prefix of haystack( up to and including the last match of needle#. The second is the remainder of haystack, following the match.breakOnEnd "::" "a::b::c"("a::b::","c")O(n+m)' Find all non-overlapping instances of needle in haystack8. Each element of the returned list consists of a pair:The entire string prior to the kth match (i.e. the prefix)The k1th match, followed by the remainder of the string Examples:breakOnAll "::" ""[]breakOnAll "/" "a/b/c/"+[("a","/b/c/"),("a/b","/c/"),("a/b/c","/")]In (unlikely) bad cases, this function's time complexity degrades towards O(n*m).The needle parameter may not be empty.O(n) l- index (subscript) operator, starting from 0.O(n) The " function takes a predicate and a l4 and returns the index of the first element in the l satisfying the predicate.O(n+m) The  function returns the number of times the query string appears in the given l. An empty query string is invalid, and will cause an error to be raised.In (unlikely) bad cases, this function's time complexity degrades towards O(n*m).O(n) The  function returns the number of times the query element appears in the given l.O(n)  takes two ls and returns a list of corresponding pairs of bytes. If one input l* is short, excess elements of the longer l1 are discarded. This is equivalent to a pair of  operations.O(n)  generalises  by zipping with the function given as the first argument, instead of a tupling function. Performs replacement on invalid scalar values.O(n) Breaks a l' up into a list of words, delimited by s representing white space.O(n) Breaks a l up into a list of ls at newline characters '\n' (LF, line feed). The resulting strings do not contain newlines. does not treat '\r'. (CR, carriage return) as a newline character.O(n)= Joins lines, after appending a terminating newline to each.O(n)+ Joins words using single space characters.O(n) The  function takes two ls and returns 4 if and only if the first is a prefix of the second.O(n) The  function takes two ls and returns 4 if and only if the first is a suffix of the second.O(n+m) The  function takes two ls and returns  if and only if the first is contained, wholly and intact, anywhere within the second.In (unlikely) bad cases, this function's time complexity degrades towards O(n*m).O(n) Return the suffix of the second string if its prefix matches the entire first string. Examples:stripPrefix "foo" "foobar" Just "bar"stripPrefix "" "baz" Just "baz"stripPrefix "foo" "quux"Nothing%This is particularly useful with the  ViewPatterns extension to GHC, as follows: {-# LANGUAGE ViewPatterns #-} import Data.Text as T fnordLength :: Text -> Int fnordLength (stripPrefix "fnord" -> Just suf) = T.length suf fnordLength _ = -1O(n) Find the longest non-empty common prefix of two strings and return it, along with the suffixes of each string at which they no longer match.If the strings do not have a common prefix or either one is empty, this function returns . Examples:!commonPrefixes "foobar" "fooquux"Just ("foo","bar","quux") commonPrefixes "veeble" "fetzer"NothingcommonPrefixes "" "baz"NothingO(n) Return the prefix of the second string if its suffix matches the entire first string. Examples:stripSuffix "bar" "foobar" Just "foo"stripSuffix "" "baz" Just "baz"stripSuffix "foo" "quux"Nothing%This is particularly useful with the  ViewPatterns extension to GHC, as follows: {-# LANGUAGE ViewPatterns #-} import Data.Text as T quuxLength :: Text -> Int quuxLength (stripSuffix "quux" -> Just pre) = T.length pre quuxLength _ = -1This instance was created by copying the updated behavior of Data.Set. and Data.Map.. If you feel a mistake has been made, please feel free to submit improvements.+The original discussion is archived here: https://mail.haskell.org/pipermail/haskell-cafe/2010-January/072379.html0could we get a Data instance for Data.Text.Text?5The followup discussion that changed the behavior of  and  is archived here: https://mail.haskell.org/pipermail/libraries/2012-August/018366.html)Proposal: Allow gunfold for Data.Map, ...texttext.Performs replacement on invalid scalar values::set -XOverloadedLists['\55555'] :: Text"\65533".Performs replacement on invalid scalar values::set -XOverloadedStrings"\55555" :: Text"\65533"textBeware: stimes6 will crash if the given number does not fit into an Int.needle? to search for. If this string is empty, an error will occur. replacement to replace needle with.haystack in which to search.String to split on. If this string is empty, an error will occur. Input text.needle to search forhaystack in which to searchonxkllkxno!(c) 2010, 2011 Bryan O'Sullivan BSD-stylebos@serpentine.comGHC Trustworthy"+hRead some text. If the read succeeds, return its value and the remaining text, otherwise an error message.Read a decimal integer. The input must begin with at least one decimal digit, and is consumed until a non-digit or end of string is reached.This function does not handle leading sign characters. If you need to handle signed input, use  .Note: For fixed-width integer types, this function does not attempt to detect overflow, so a sufficiently long input may give incorrect results. If you are worried about overflow, use  for your result type.?Read a hexadecimal integer, consisting of an optional leading "0x" followed by at least one hexadecimal digit. Input is consumed until a non-hex-digit or end of string is reached. This function is case insensitive.This function does not handle leading sign characters. If you need to handle signed input, use  .Note: For fixed-width integer types, this function does not attempt to detect overflow, so a sufficiently long input may give incorrect results. If you are worried about overflow, use  for your result type.)Read an optional leading sign character ('-' or '+';) and apply it to the result of applying the given reader.Read a rational number.This function accepts an optional leading sign character, followed by at least one decimal digit. The syntax similar to that accepted by the . function, with the exception that a trailing '.' or 'e' not& followed by a number is not consumed.&Examples (with behaviour identical to ): rational "3" == Right (3.0, "") rational "3.1" == Right (3.1, "") rational "3e4" == Right (30000.0, "") rational "3.1e4" == Right (31000.0, "") rational ".3" == Left "input does not start with a digit" rational "e3" == Left "input does not start with a digit"Examples of differences from : rational "3.foo" == Right (3.0, ".foo") rational "3e" == Right (3.0, "e")Read a rational number.8The syntax accepted by this function is the same as for .Note0: This function is almost ten times faster than !, but is slightly less accurate.The  type supports about 16 decimal places of accuracy. For 94.2% of numbers, this function and  give identical results, but for the remaining 5.8%, this function loses precision around the 15th decimal place. For 0.001% of numbers, this function will lose precision at the 13th or 14th decimal place.#(c) 2009, 2010 Bryan O'Sullivan BSD-stylebos@serpentine.com experimentalGHCNone. %Type synonym for the lazy flavour of .text Empty text.8Chunks must be non-empty, this invariant is not checked.Check the invariant strictly.Check the invariant lazily.)Display the internal structure of a lazy .Smart constructor for %. Guarantees the data type invariant.Smart constructor for .Consume the chunks of a lazy  with a natural right fold.Consume the chunks of a lazy 8 with a strict, tail-recursive, accumulating left fold.=Currently set to 16 KiB, less the memory management overhead.Currently set to 128 bytes, less the memory management overhead.The memory management overhead. Currently this is tuned for GHC only.(c) 2013 Bryan O'Sullivan BSD-stylebos@serpentine.com experimentalGHCNone/$(c) 2009, 2010 Bryan O'Sullivan BSD-stylebos@serpentine.com experimentalGHCNone 2O(n+m)5 Find the offsets of all non-overlapping indices of needle within haystack.This function is strict in needle2, and lazy (as far as possible) in the chunks of haystack.In (unlikely) bad cases, this algorithm's complexity degrades towards O(n*m)."Fast index into a partly unpacked . We take into account the possibility that the caller might try to access one element past the end. A variant of " that scans linearly for a single .:First argument is a strict Text, and second is a lazy one.Substring to search for (needle)Text to search in (haystack)%(c) 2009, 2010 Bryan O'Sullivan BSD-stylebos@serpentine.com experimentalGHCNone6l O(n) Convert a  into a 'Stream Char'.textO(n)  t =  (t <> '\n')Shared implementation of  and .O(n) Convert a 'Stream Char' into a , using the given chunk size.O(n) Convert a 'Stream Char' into a  , using .O(n), Returns the number of characters in a text.O(n) Like unfoldr,  builds a stream from a seed value. However, the length of the result is limited by the first argument to (. This function is more efficient than unfoldr( when the length of the result is known.O(n)4 stream index (subscript) operator, starting from 0.O(n) The count function returns the number of times the query element appears in the given stream.&(c) 2009, 2010 Bryan O'Sullivan BSD-stylebos@serpentine.comportable Trustworthy(@ Decode a  ByteString& containing 7-bit ASCII encoded text. Decode a  ByteString2 containing Latin-1 (aka ISO-8859-1) encoded text. Decode a  ByteString containing UTF-8 encoded text. Decode a  ByteString: containing UTF-8 encoded text that is known to be valid.If the input contains any invalid UTF-8 data, an exception will be thrown that cannot be caught in pure code. For more control over the handling of invalid data, use  or . Decode a  ByteString containing UTF-8 encoded text..If the input contains any invalid UTF-8 data, the relevant exception will be returned, otherwise the decoded text.Note: this function is not lazy, as it must decode its entire input before it can return a result. If you need lazy (streaming) decoding, use  in lenient mode.!Encode text using UTF-8 encoding.textEncode text to a ByteString  using UTF-8 encoding.textEncode text using UTF-8 encoding and escape the ASCII characters using a .Use this function is to implement efficient encoders for text-based formats like JSON or HTML./Decode text from little endian UTF-16 encoding./Decode text from little endian UTF-16 encoding.If the input contains any invalid little endian UTF-16 data, an exception will be thrown. For more control over the handling of invalid data, use .,Decode text from big endian UTF-16 encoding.,Decode text from big endian UTF-16 encoding.If the input contains any invalid big endian UTF-16 data, an exception will be thrown. For more control over the handling of invalid data, use .0Encode text using little endian UTF-16 encoding.-Encode text using big endian UTF-16 encoding./Decode text from little endian UTF-32 encoding./Decode text from little endian UTF-32 encoding.If the input contains any invalid little endian UTF-32 data, an exception will be thrown. For more control over the handling of invalid data, use .,Decode text from big endian UTF-32 encoding.,Decode text from big endian UTF-32 encoding.If the input contains any invalid big endian UTF-32 data, an exception will be thrown. For more control over the handling of invalid data, use .0Encode text using little endian UTF-32 encoding.-Encode text using big endian UTF-32 encoding."%(c) 2009, 2010, 2012 Bryan O'Sullivan BSD-stylebos@serpentine.comGHC Trustworthy (#text"Bidirectional pattern synonym for  (O(n)) and  (O(1)) to be used together with .text"Bidirectional pattern synonym for  (O(n)) and  (O(1)), to be used together with .O(n) Convert a  into a .2Performs replacement on invalid scalar values, so  .  is not id:4Data.Text.Lazy.unpack (Data.Text.Lazy.pack "\55555")"\65533"O(n) Convert a  into a .O(n)& Convert a literal string into a Text.O(1) Convert a character into a Text. Performs replacement on invalid scalar values.O(c) Convert a list of strict Ss into a lazy .O(n) Convert a lazy  into a list of strict Ss.O(n) Convert a lazy  into a strict S.O(c) Convert a strict S into a lazy .O(1)$ Adds a character to the front of a .O(n)" Adds a character to the end of a 0. This copies the entire array in the process.O(n/c) Appends one  to another.O(1)+ Returns the first character and rest of a , or  if empty.O(1)" Returns the first character of a , which must be non-empty. This is a partial function, consider using  instead.O(1), Returns all characters after the head of a , which must be non-empty. This is a partial function, consider using  instead.O(n/c)) Returns all but the last character of a , which must be non-empty. This is a partial function, consider using  instead.textO(n/c) Returns the  and  of a , or  if empty.It is no faster than using  and .O(1) Tests whether a  is empty or not.O(1) Tests whether a  contains exactly one character.O(n/c)! Returns the last character of a , which must be non-empty. This is a partial function, consider using  instead.O(n)' Returns the number of characters in a . O(min(n,c))& Compare the count of characters in a  to a number.  t c =  ( t) c This function gives the same answer as comparing against the result of , but can short circuit if the count of characters is greater than the number, and hence be more efficient.O(n)  f t is the  obtained by applying f to each element of t1. Performs replacement on invalid scalar values.O(n) The  function takes a  and a list of s and concatenates the list after interspersing the first argument between each element of the list.O(n) The  function takes a character and places it between the characters of a 1. Performs replacement on invalid scalar values.O(n) Left-justify a string to the given length, using the specified fill character on the right. Performs replacement on invalid scalar values. Examples: justifyLeft 7 'x' "foo" == "fooxxxx" justifyLeft 3 'x' "foobar" == "foobar"O(n) Right-justify a string to the given length, using the specified fill character on the left. Performs replacement on invalid scalar values. Examples: justifyRight 7 'x' "bar" == "xxxxbar" justifyRight 3 'x' "foobar" == "foobar"O(n) Center a string to the given length, using the specified fill character on either side. Performs replacement on invalid scalar values. Examples: center 8 'x' "HS" = "xxxHSxxx"O(n) The 2 function transposes the rows and columns of its ) argument. Note that this function uses , , and the list version of transpose, and is thus not very efficient.O(n)  t returns the elements of t in reverse order.O(m+n)- Replace every non-overlapping occurrence of needle in haystack with  replacement.:This function behaves as though it was defined as follows: (replace needle replacement haystack =  replacement ( needle haystack) As this suggests, each occurrence is replaced exactly once. So if needle occurs in  replacement, that occurrence will not! itself be replaced recursively:  replace "oo" "foo" "oo" == "foo"$In cases where several instances of needle/ overlap, only the first one will be replaced: &replace "ofo" "bar" "ofofo" == "barfo"In (unlikely) bad cases, this function's time complexity degrades towards O(n*m).O(n)! Convert a string to folded case.This function is mainly useful for performing caseless (or case insensitive) string comparisons. A string x" is a caseless match for a string y if and only if: toCaseFold x == toCaseFold yThe result string may be longer than the input string, and may differ from applying  to the input string. For instance, the Armenian small ligature men now (U+FB13) is case folded to the bigram men now (U+0574 U+0576), while the micro sign (U+00B5) is case folded to the Greek small letter letter mu (U+03BC) instead of itself.O(n)? Convert a string to lower case, using simple case conversion.The result string may be longer than the input string. For instance, the Latin capital letter I with dot above (U+0130) maps to the sequence Latin small letter i (U+0069) followed by combining dot above (U+0307).O(n)? Convert a string to upper case, using simple case conversion.The result string may be longer than the input string. For instance, the German eszett (U+00DF) maps to the two-letter sequence SS.textO(n)? Convert a string to title case, using simple case conversion.#The first letter (as determined by 3R) of the input is converted to title case, as is every subsequent letter that immediately follows a non-letter. Every letter that immediately follows another letter is converted to lower case.The result string may be longer than the input string. For example, the Latin small ligature  (U+FB02) is converted to the sequence Latin capital letter F (U+0046) followed by Latin small letter l (U+006C).=This function is not idempotent. Consider lower-case letter = (U+0149 LATIN SMALL LETTER N PRECEDED BY APOSTROPHE). Then ST "" = "N": the first (and the only) letter of the input is converted to title case, becoming two letters. Now  (U+02BC MODIFIER LETTER APOSTROPHE) is a modifier letter and as such is recognised as a letter by 3R, so ST "N" = "'n".Note: this function does not take language or culture specific rules into account. For instance, in English, different style guides disagree on whether the book name "The Hill of the Red Fox" is correctly title cased@but this function will capitalize every word.O(n) , applied to a binary operator, a starting value (typically the left-identity of the operator), and a , reduces the / using the binary operator, from left to right.O(n) A strict version of .O(n) A variant of  that has no starting value argument, and thus must be applied to a non-empty .O(n) A strict version of .textO(n) A monadic version of .O(n) , applied to a binary operator, a starting value (typically the right-identity of the operator), and a , reduces the / using the binary operator, from right to left. is lazy like Z/ for lists: evaluation actually traverses the 0 from left to right, only as far as it needs to. For example,  can be defined with O(1) complexity using : =head :: Text -> Char head = foldr const (error "head empty") O(n) A variant of  that has no starting value argument, and thus must be applied to a non-empty .O(n) Concatenate a list of s.O(n) Map a function over a  that results in a , and concatenate the results.O(n)  p t* determines whether any character in the  t satisfies the predicate p.O(n)  p t+ determines whether all characters in the  t satisfy the predicate p.O(n) " returns the maximum value from a , which must be non-empty.O(n) " returns the minimum value from a , which must be non-empty.textO(n) Test whether  contains only ASCII code-points (i.e. only U+0000 through U+007F).$This is a more efficient version of  3. isAscii ""TrueisAscii "abc\NUL"TrueisAscii "abcdA"FalseisAscii t == all (< '\x80') tO(n)  is similar to , but returns a list of successive reduced values from the left. Performs replacement on invalid scalar values. scanl f z [x1, x2, ...] == [z, z `f` x1, (z `f` x1) `f` x2, ...] Note that $last (scanl f z xs) == foldl f z xs.O(n)  is a variant of  that has no starting value argument. Performs replacement on invalid scalar values. .scanl1 f [x1, x2, ...] == [x1, x1 `f` x2, ...]O(n)  is the right-to-left dual of 2. Performs replacement on invalid scalar values. 1scanr f v == reverse . scanl (flip f) v . reverseO(n)  is a variant of  that has no starting value argument. Performs replacement on invalid scalar values.O(n) Like a combination of  and +. Applies a function to each element of a , passing an accumulating parameter from left to right, and returns a final 2. Performs replacement on invalid scalar values.The ( function behaves like a combination of  and a strict .; it applies a function to each element of a , passing an accumulating parameter from right to left, and returning a final value of this accumulator together with the new 1. Performs replacement on invalid scalar values.text x is an infinite , with x the value of every element.O(n*m)  n t is a  consisting of the input t repeated n times.text ties a finite, non-empty  into a circular one, or equivalently, the infinite repetition of the original .text f x returns an infinite  of repeated applications of f to x: %iterate f x == [x, f x, f (f x), ...]O(n), where n" is the length of the result. The $ function is analogous to the List \d.  builds a  from a seed value. The function takes the element and returns  if it is done producing the  , otherwise  (a,b). In this case, a is the next  in the string, and b is the seed value for further production. Performs replacement on invalid scalar values.O(n) Like ,  builds a  from a seed value. However, the length of the result should be limited by the first argument to (. This function is more efficient than  when the maximum length of the result is known and correct, otherwise its performance is similar to 1. Performs replacement on invalid scalar values.O(n)  n, applied to a , returns the prefix of the  of length n , or the  itself if n) is greater than the length of the Text.textO(n)  n t, returns the suffix remaining after taking n characters from the end of t. Examples: takeEnd 3 "foobar" == "bar"O(n)  n, applied to a , returns the suffix of the  after the first n characters, or the empty  if n$ is greater than the length of the .textO(n)  n t. returns the prefix remaining after dropping n characters from the end of t. Examples: dropEnd 3 "foobar" == "foo"O(n)  n returns the suffix with n Word8 values dropped, or the empty  if n is greater than the number of Word8 values present.O(n) , applied to a predicate p and a , returns the longest prefix (possibly empty) of elements that satisfy p.textO(n) , applied to a predicate p and a , returns the longest suffix (possibly empty) of elements that satisfy p . Examples: "takeWhileEnd (=='o') "foo" == "oo"O(n)  p t% returns the suffix remaining after  p t.O(n)  p t returns the prefix remaining after dropping characters that satisfy the predicate p from the end of t. Examples: &dropWhileEnd (=='.') "foo..." == "foo"O(n)  p t returns the substring remaining after dropping characters that satisfy the predicate p% from both the beginning and end of t.O(n): Remove leading white space from a string. Equivalent to: dropWhile isSpaceO(n); Remove trailing white space from a string. Equivalent to: dropWhileEnd isSpaceO(n) Remove leading and trailing white space from a string. Equivalent to: dropAround isSpaceO(n)  n t4 returns a pair whose first element is a prefix of t of length n, and whose second is the remainder of the string. It is equivalent to ( n t,  n t).O(n)  n t; returns a strict pair whose first element is a prefix of t whose chunks contain n Word8: values, and whose second is the remainder of the string.O(n+m) Find the first instance of needle (which must be non-) in haystack=. The first element of the returned tuple is the prefix of haystack before needle. is matched. The second is the remainder of haystack, starting with the match. Examples: breakOn "::" "a::b::c" ==> ("a", "::b::c") breakOn "/" "foobar" ==> ("foobar", "")Laws: append prefix match == haystack where (prefix, match) = breakOn needle haystackIf you need to break a string by a substring repeatedly (e.g. you want to break on every instance of a substring), use , instead, as it has lower startup overhead.This function is strict in its first argument, and lazy in its second.In (unlikely) bad cases, this function's time complexity degrades towards O(n*m).O(n+m) Similar to *, but searches from the end of the string.9The first element of the returned tuple is the prefix of haystack( up to and including the last match of needle#. The second is the remainder of haystack, following the match. -breakOnEnd "::" "a::b::c" ==> ("a::b::", "c")O(n+m)' Find all non-overlapping instances of needle in haystack8. Each element of the returned list consists of a pair:The entire string prior to the kth match (i.e. the prefix)The k1th match, followed by the remainder of the string Examples: breakOnAll "::" "" ==> [] breakOnAll "/" "a/b/c/" ==> [("a", "/b/c/"), ("a/b", "/c/"), ("a/b/c", "/")]This function is strict in its first argument, and lazy in its second.In (unlikely) bad cases, this function's time complexity degrades towards O(n*m).The needle parameter may not be empty.O(n)  is like , but the prefix returned is over elements that fail the predicate p.T.break (=='c') "180cm" ("180","cm")O(n) , applied to a predicate p and text t, returns a pair whose first element is the longest prefix (possibly empty) of t of elements that satisfy p1, and whose second is the remainder of the text.T.span (=='0') "000AB" ("000","AB")textO(length of prefix) !, applied to a monadic predicate p , a text t, returns a pair (t1, t2) where t1 is the longest prefix of t whose elements satisfy p, and t2 is the remainder of the text.T.spanM (\c -> state $ \i -> (fromEnum c == i, i+1)) "abcefg" `runState` 97(("abc","efg"),101) is  specialized to : -- for all p :: Char -> Bool  p =  .  ( . p) textO(length of suffix) !, applied to a monadic predicate p , a text t, returns a pair (t1, t2) where t2 is the longest suffix of t whose elements satisfy p, and t1 is the remainder of the text.T.spanEndM (\c -> state $ \i -> (fromEnum c == i, i-1)) "tuvxyz" `runState` 122(("tuv","xyz"),118)  p .  = fmap (s  ) .  p The  function takes a  and returns a list of s such that the concatenation of the result is equal to the argument. Moreover, each sublist in the result contains only equal elements. For example, :group "Mississippi" = ["M","i","ss","i","ss","i","pp","i"]It is a special case of , which allows the programmer to supply their own equality test.The + function is the non-overloaded version of .O(n)* Return all initial segments of the given , shortest first.textO(n)* Return all initial segments of the given , shortest first.O(n)( Return all final segments of the given , longest first.textO(n)( Return all final segments of the given , longest first.O(m+n) Break a $ into pieces separated by the first  argument (which cannot be an empty string), consuming the delimiter. An empty delimiter is invalid, and will cause an error to be raised. Examples: splitOn "\r\n" "a\r\nb\r\nd\r\ne" == ["a","b","d","e"] splitOn "aaa" "aaaXaaaXaaaXaaa" == ["","X","X","X",""] splitOn "x" "x" == ["",""]and intercalate s . splitOn s == id splitOn (singleton c) == split (==c)(Note: the string s$ to split on above cannot be empty.)This function is strict in its first argument, and lazy in its second.In (unlikely) bad cases, this function's time complexity degrades towards O(n*m).O(n) Splits a  into components delimited by separators, where the predicate returns True for a separator element. The resulting components do not contain the separators. Two adjacent separators result in an empty component in the output. eg. split (=='a') "aabbaca" == ["","","bb","c",""] split (=='a') [] == [""]O(n) Splits a  into components of length k. The last element may be shorter than the other chunks, depending on the length of the input. Examples: chunksOf 3 "foobarbaz" == ["foo","bar","baz"] chunksOf 4 "haskell.org" == ["hask","ell.","org"]O(n) Breaks a  up into a list of s at newline characters '\n' (LF, line feed). The resulting strings do not contain newlines. does not treat '\r'. (CR, carriage return) as a newline character.O(n) Breaks a ' up into a list of words, delimited by s representing white space.O(n)= Joins lines, after appending a terminating newline to each.O(n)+ Joins words using single space characters.O(n) The  function takes two s and returns 4 if and only if the first is a prefix of the second.O(n) The  function takes two s and returns 4 if and only if the first is a suffix of the second.O(n+m) The  function takes two s and returns  if and only if the first is contained, wholly and intact, anywhere within the second.This function is strict in its first argument, and lazy in its second.In (unlikely) bad cases, this function's time complexity degrades towards O(n*m).O(n) Return the suffix of the second string if its prefix matches the entire first string. Examples: stripPrefix "foo" "foobar" == Just "bar" stripPrefix "" "baz" == Just "baz" stripPrefix "foo" "quux" == Nothing%This is particularly useful with the  ViewPatterns extension to GHC, as follows: {-# LANGUAGE ViewPatterns #-} import Data.Text.Lazy as T fnordLength :: Text -> Int fnordLength (stripPrefix "fnord" -> Just suf) = T.length suf fnordLength _ = -1O(n) Find the longest non-empty common prefix of two strings and return it, along with the suffixes of each string at which they no longer match.If the strings do not have a common prefix or either one is empty, this function returns . Examples: commonPrefixes "foobar" "fooquux" == Just ("foo","bar","quux") commonPrefixes "veeble" "fetzer" == Nothing commonPrefixes "" "baz" == NothingO(n) Return the prefix of the second string if its suffix matches the entire first string. Examples: stripSuffix "bar" "foobar" == Just "foo" stripSuffix "" "baz" == Just "baz" stripSuffix "foo" "quux" == Nothing%This is particularly useful with the  ViewPatterns extension to GHC, as follows: {-# LANGUAGE ViewPatterns #-} import Data.Text.Lazy as T quuxLength :: Text -> Int quuxLength (stripSuffix "quux" -> Just pre) = T.length pre quuxLength _ = -1O(n) , applied to a predicate and a  , returns a 9 containing those characters that satisfy the predicate.O(n) The " function takes a predicate and a ?, and returns the first element in matching the predicate, or  if there is no such element.O(n) The " function takes a character and a , and returns & if the element is found in the given , or  otherwise.O(n) The " function takes a predicate and a , and returns the pair of s with elements which do and do not satisfy the predicate, respectively; i.e. 1partition p t == (filter p t, filter (not . p) t)O(n) - index (subscript) operator, starting from 0.O(n+m) The  function returns the number of times the query string appears in the given . An empty query string is invalid, and will cause an error to be raised.In (unlikely) bad cases, this function's time complexity degrades towards O(n*m).O(n) The  function returns the number of times the query element appears in the given .O(n)  takes two s and returns a list of corresponding pairs of bytes. If one input * is short, excess elements of the longer 1 are discarded. This is equivalent to a pair of  operations.O(n)  generalises  by zipping with the function given as the first argument, instead of a tupling function. Performs replacement on invalid scalar values.textConvert a value to lazy .texttextThis instance preserves data abstraction at the cost of inefficiency. We omit reflection services for the sake of data abstraction.>This instance was created by copying the updated behavior of  Data.Text.texttext.Performs replacement on invalid scalar values::set -XOverloadedLists!['\55555'] :: Data.Text.Lazy.Text"\65533".Performs replacement on invalid scalar values::set -XOverloadedStrings"\55555" :: Data.Text.Lazy.Text"\65533"textneedle? to search for. If this string is empty, an error will occur. replacement to replace needle with.haystack in which to search.needle to search forhaystack in which to searchString to split on. If this string is empty, an error will occur. Input text.'(c) 2010, 2011 Bryan O'Sullivan BSD-stylebos@serpentine.comGHC Trustworthy"Read some text. If the read succeeds, return its value and the remaining text, otherwise an error message.Read a decimal integer. The input must begin with at least one decimal digit, and is consumed until a non-digit or end of string is reached.This function does not handle leading sign characters. If you need to handle signed input, use  .Note: For fixed-width integer types, this function does not attempt to detect overflow, so a sufficiently long input may give incorrect results. If you are worried about overflow, use  for your result type.?Read a hexadecimal integer, consisting of an optional leading "0x" followed by at least one hexadecimal digit. Input is consumed until a non-hex-digit or end of string is reached. This function is case insensitive.This function does not handle leading sign characters. If you need to handle signed input, use  .Note: For fixed-width integer types, this function does not attempt to detect overflow, so a sufficiently long input may give incorrect results. If you are worried about overflow, use  for your result type.)Read an optional leading sign character ('-' or '+';) and apply it to the result of applying the given reader.Read a rational number.This function accepts an optional leading sign character, followed by at least one decimal digit. The syntax similar to that accepted by the . function, with the exception that a trailing '.' or 'e' not& followed by a number is not consumed. Examples: rational "3" == Right (3.0, "") rational "3.1" == Right (3.1, "") rational "3e4" == Right (30000.0, "") rational "3.1e4" == Right (31000.0, "") rational ".3" == Left "input does not start with a digit" rational "e3" == Left "input does not start with a digit"Examples of differences from : rational "3.foo" == Right (3.0, ".foo") rational "3e" == Right (3.0, "e")Read a rational number.8The syntax accepted by this function is the same as for .Note0: This function is almost ten times faster than !, but is slightly less accurate.The  type supports about 16 decimal places of accuracy. For 94.2% of numbers, this function and  give identical results, but for the remaining 5.8%, this function loses precision around the 15th decimal place. For 0.001% of numbers, this function will lose precision at the 13th or 14th decimal place.For the sake of performance this function does not check that a char is in ASCII range; it is a responsibility of p.((c) 2009, 2010 Bryan O'Sullivan, (c) 2009 Simon Marlow BSD-stylebos@serpentine.com experimentalGHCNone%&Read a single line of input from a handle, constructing a list of decoded chunks as we go. When we're done, transform them into the destination type.Read a single chunk of strict text from a buffer. Used by both the strict and lazy implementations of hGetContents.Print a  Stream Char.Write a string to a handle.2Write a string to a handle, followed by a newline. with an optional special case when the output encoding is UTF-8 and without newline conversion.:Only modifies the raw buffer and not the buffer attributes)(c) 2009, 2010 Bryan O'Sullivan, (c) 2009 Simon Marlow BSD-stylebos@serpentine.comGHC Trustworthy%& Read a file and return its contents as a string. The file is read lazily, as with .(Beware that this function (similarly to ) is locale-dependent. Unexpected system locale may cause your application to read corrupted data or throw runtime exceptions about "invalid argument (invalid byte sequence)" or "invalid argument (invalid character)". This is also slow, because GHC first converts an entire input to UTF-32, which is afterwards converted to UTF-8.If your data is UTF-8, using &  ) is a much faster and safer alternative.Write a string to a file. The file is truncated to zero length before writing begins.$Write a string to the end of a file.(Lazily read the remaining contents of a . The 7 will be closed after the read completes, or on error.Use a more efficient buffer size if we're reading in block-buffered mode with the default buffer size.!Read a single line from a handle.Write a string to a handle.2Write a string to a handle, followed by a newline.The # function takes a function of type  Text -> Text as its argument. The entire input from the standard input device is passed (lazily) to this function as its argument, and the resulting string is output on the standard output device.Lazily read all user input on  as a single string.&Read a single line of user input from .Write a string to .Write a string to , followed by a newline.  +>(c) 2013 Bryan O'Sullivan (c) 2010 Johan TibellBSD-style (see LICENSE)%Johan Tibell  experimentalportable to Hugs and GHCNoneA Builder# is an efficient way to build lazy Text values. There are several functions for constructing builders, but only one to inspect them: to extract any data, you have to turn them into lazy Text values using  toLazyText.(Internally, a builder constructs a lazy Text by filling arrays piece by piece. As each buffer is filled, it is 'popped' off, to become a new chunk of the resulting lazy Text,. All this is hidden from the user of the Builder.O(1). The empty Builder , satisfying   = \O(1). A Builder& taking a single character, satisfying  ( c) = \: cO(1). The concatenation of two builders, an associative operation with identity  , satisfying  ( x y) = \A ( x) ( y)O(1). A Builder taking a  , satisfying  ( t) = \ [t]textO(1). A Builder taking a String , satisfying  ( s) = \ [S.pack s].Performs replacement on invalid scalar values:fromString "\55555""\65533"O(1). A Builder taking a lazy Text , satisfying  ( t) = tO(n). Extract a lazy Text from a Builder with a default buffer size. The construction work takes place if and when the relevant part of the lazy Text is demanded.O(n). Extract a lazy Text from a Builder, using the given size for the initial buffer. The construction work takes place if and when the relevant part of the lazy Text is demanded.If the initial buffer is too small to hold all data, subsequent buffers will be the default buffer size.O(1). Pop the strict Text we have constructed so far, if any, yielding a new chunk in the result lazy Text.&Sequence an ST operation on the bufferGet the size of the buffer Map the resulting list of texts.Ensure that there are at least n many elements available. Ensure that n+ many elements are available, and then use f) to write some elements into the memory..Performs replacement on invalid scalar values::set -XOverloadedStrings"\55555" :: Builder"\65533"  *>(c) 2013 Bryan O'Sullivan (c) 2010 Johan TibellBSD-style (see LICENSE)%Johan Tibell portable to Hugs and GHC Trustworthy  ,(c) 2011 MailRank, Inc. BSD-stylebos@serpentine.com experimentalGHCNone%Unsafe conversion for decimal digits. The normal 4 function with right associativity instead of left.- Trustworthy .'(c) The University of Glasgow 1994-2002see libraries/base/LICENSE Trustworthy"~0Control the rendering of floating point numbers.Scientific notation (e.g. 2.3e123).Standard decimal notation.(Use decimal notation for values between 0.1 and  9,999,999$, and scientific notation otherwise.Show a signed  value to full precision, using standard decimal notation for arguments whose absolute value lies between 0.1 and  9,999,999$, and scientific notation otherwise.Encode a signed  according to $ and optionally requested precision.This corresponds to the show{E,F,G}Float operations provided by base's Numeric module.NOTE: The functions in  base-4.12) changed the serialisation in case of a Just 0 precision; this version of text5 still provides the serialisation as implemented in  base-4.11. The next major version of text! will switch to the more correct  base-4.12 serialisation.! takes a base and a non-negative  number, and returns a list of digits and an exponent. In particular, if x>=0, and *floatToDigits base x = ([d1,d2,...,dn], e)then  n >= 1 x = 0.d1d2...dn * (base**e) 0 <= di <= base-1#Number of decimal places to render./ BSD-styleGHC Safe-Inferredw The  function reads a file and returns the contents of the file as a string. The entire file is read strictly, as with .Write a string to a file. The file is truncated to zero length before writing begins.$Write a string to the end of a file.!Read the remaining contents of a  as a string.!Read a single line from a handle.Write a string to a handle.2Write a string to a handle, followed by a newline.The # function takes a function of type  Text -> Text as its argument. The entire input from the standard input device is passed to this function as its argument, and the resulting string is output on the standard output device.Read all user input on stdin as a single string.&Read a single line of user input from stdin.Write a string to stdout.Write a string to stdout, followed by a newline.  0(c) 2009, 2010 Bryan O'Sullivan, (c) 2009 Simon Marlow BSD-stylebos@serpentine.comGHC Trustworthy%& The  function reads a file and returns the contents of the file as a string. The entire file is read strictly, as with .(Beware that this function (similarly to ) is locale-dependent. Unexpected system locale may cause your application to read corrupted data or throw runtime exceptions about "invalid argument (invalid byte sequence)" or "invalid argument (invalid character)". This is also slow, because GHC first converts an entire input to UTF-32, which is afterwards converted to UTF-8.If your data is UTF-8, using   r) is a much faster and safer alternative.Write a string to a file. The file is truncated to zero length before writing begins.$Write a string to the end of a file.Wrap readChunk and return a value indicating if we're reached the EOF. This is needed because unpack_nl is unable to discern the difference between a buffer with just r due to EOF or because not enough data was left for decoding. e.g. the final character decoded from the byte buffer was r. Experimental., Read a single chunk of strict text from a . The size of the chunk depends on the amount of input currently buffered.This function blocks only if there is no data available, and EOF has not yet been reached. Once EOF is reached, this function returns an empty string instead of throwing an exception.!Read the remaining contents of a  as a string. The  is closed once the contents have been read, or if an exception is thrown.Internally, this function reads a chunk at a time from the lower-level buffering abstraction, and concatenates the chunks into a single string once the entire file has been read.As a result, it requires approximately twice as much memory as its result to construct its result. For files more than a half of available RAM in size, this may result in memory exhaustion.Use a more efficient buffer size if we're reading in block-buffered mode with the default buffer size. When we can determine the size of the handle we're reading, set the buffer size to that, so that we can read the entire file in one chunk. Otherwise, use a buffer size of at least 16KB.!Read a single line from a handle.The # function takes a function of type  Text -> Text as its argument. The entire input from the standard input device is passed to this function as its argument, and the resulting string is output on the standard output device.Read all user input on  as a single string.&Read a single line of user input from .Write a string to .Write a string to , followed by a newline.                                       S S          A;w7:?@ABGIJKLMNOPQTUVWXYZ[]_`abcdfghijknpz}~=5=>==:<9uemoq99|{x                     ?@BGIJKLuNOQPTUVWXYZ[]_`abcdefghiklnmopj!!!!!!###############$%<%%%9%u%e%m%q&&&{&&&x&&&&&&&&&&&&&&""";"5":"""""?"@"A"G"B"J"K""L"I"u""N""O""""""""Q"P"T"U"V"W"X"Y"Z"["]"_"`"a"b"c""""""""""""d"e"f""g""h""i"""""""""""""""""""""""""""j""""""n"l"k""m"""p""""""""""""""''''''((((())))))))))))+++:+++++++++++++++,,--..........////////////00000000000 277yBJ=Mq$m$$j%">"M"""q'(()++A+++.00text-2.1.3-84aeData.Text.Internal.PrimCompatData.Text.UnsafeData.Text.ArrayData.Text.Encoding.ErrorData.Text.Internal.ArrayUtils%Data.Text.Internal.Builder.Int.Digits.Data.Text.Internal.Builder.RealFloat.Functions#Data.Text.Internal.ByteStringCompat!Data.Text.Internal.Encoding.Utf16!Data.Text.Internal.Encoding.Utf32 Data.Text.Internal.Encoding.Utf8%Data.Text.Internal.Fusion.CaseMappingData.Text.Internal.ReadData.Text.Internal.UnsafeData.Text.Internal.Unsafe.Char Data.TextData.Text.Internal Data.Text.Internal.StrictBuilderData.Text.Internal.SearchData.Text.Internal.Fusion.SizeData.Text.Internal.Fusion.Types Data.Text.Internal.Fusion.CommonData.Text.Internal.Encoding"Data.Text.Internal.Validate.NativeData.Text.Internal.ValidateData.Text.Internal.PrivateData.Text.Internal.Fusion)Data.Text.Internal.Encoding.Fusion.Common'Data.Text.Internal.Lazy.Encoding.Fusion"Data.Text.Internal.Encoding.FusionData.Text.EncodingData.Text.ForeignData.Text.ReadData.Text.LazyData.Text.Internal.LazyData.Text.Internal.Lazy.SearchData.Text.Internal.Lazy.FusionData.Text.Lazy.EncodingData.Text.Lazy.ReadData.Text.Internal.IOData.Text.Lazy.IOData.Text.Lazy.BuilderData.Text.Internal.Builder$Data.Text.Internal.Builder.FunctionsData.Text.Lazy.Builder.Int Data.Text.Lazy.Builder.RealFloatData.Text.IO.Utf8 Data.Text.IOData.Text.Internal.Measure Data.Char Surrogateunpack7Data.Text.Internal.Reverse2unstream singletonpackstreamData.Text.ShowunpackCString#conssnocappendhead Data.Functorfmap Data.Tuplefstunconssndlasttailinitnull isSingletonmap interspersetoUppertoLowerisLetterTtoTitlefoldlfoldl'foldl1foldl1'foldlM'foldrfoldr1LconcatData.Text.Fusion concatMapanyallmaximumminimumunfoldrunfoldrNtakedrop takeWhile dropWhile isPrefixOfelemfindindexfilter findIndexzipWith countCharData.ByteStringData.BifunctorfirstlengthSBtoText encodeUtf8partUtf8ToByteStringstrictBuilderToTextdecodeUtf8WithstreamDecodeUtf8WithisValidUtf8ByteStringisValidUtf8ByteArrayUnpinnedisValidUtf8ByteArrayPinnedGHCunpackCStringUtf8#!Data.Text.Internal.Transformation Data.Functionidreversescanr mapAccumLData.Text.Internal.IsAsciiisAsciiBBuilderBP BoundedPrimPcompare Data.ListData.Functor.IdentityIdentity runIdentitybimapData.SetSetData.MapMap5Data.Text.Lazy.InternalTextPreludereadFile decodeUtf8Data.ByteString.LazyemptyS fromChunks4ghc-primGHC.Prim word8ToWord# wordToWord8# word16ToWord# wordToWord16# word32ToWord# wordToWord32# ghc-internalGHC.Internal.IO.UnsafeunsafeDupablePerformIObaseData.Array.ByteMutableByteArray ByteArrayMArrayArraynew newPinned newFilledtile unsafeFreeze unsafeIndexgetSizeofMArray unsafeWritetoListrunrun2resizeMshrinkMcopyMcopyIcopyFromPointer copyToPointerequalUnicodeException DecodeError EncodeError OnEncodeError OnDecodeErrorOnError strictDecode lenientDecode strictEncodeignorereplace$fNFDataUnicodeException$fExceptionUnicodeException$fShowUnicodeException$fEqUnicodeExceptionmemchrdigitsroundTomkBSwithBSchr2 validate1 validate2validate DecoderResultAccept IncompleteReject CodePoint DecoderState utf8Lengthutf8LengthByLeaderord2ord3ord4chr3chr4 validate3 validate4utf8AcceptStateutf8RejectStateupdateDecoderStateutf8DecodeStartutf8DecodeContinue$fEqDecoderState$fShowDecoderStateunI64 upperMapping lowerMapping titleMapping foldMappingIParserrunPIReaderperhaps hexDigitToInt digitToInt$fMonadIParser$fApplicativeIParser$fFunctorIParserinlinePerformIOinlineInterleaveSTunsafeWithForeignPtrord unsafeChr16 unsafeChr8 unsafeChr32 StrictTexttexttextPshowTextsafefirstfmulmul64mul32 StrictBuilderStrictTextBuildersbWritesbLengthunsafeFromByteStringfromCharunsafeFromWord8fromText$fMonoidStrictTextBuilder$fSemigroupStrictTextBuilderindicesSizeexactlycharSizecodePointsSize exactSizemaxSize betweenSize unionSize unknownSizesmallerlarger upperBound lowerBound compareSizeisEmpty $fNumSize$fEqSize $fShowSizeStreamStepDoneSkipYieldScanScan1Scan2PairS:*:RSRS0RS1RS2RS3CC $fOrdStream $fEqStream streamList unstreamListstreamCString#lengthIcompareLengthI toCaseFold justifyLeftI intercalatescanlreplicateCharI replicateI unfoldrNIfindByindexI findIndexI countCharI Utf8StatetextToStrictBuilderstartUtf8StategetCompleteLengetPartialUtf8validateUtf8ChunkvalidateUtf8MoredecodeUtf8MoredecodeUtf8ChunkskipIncompletedecodeUtf8With1decodeUtf8With2 $fEqUtf8State$fShowUtf8State$fEqPartialUtf8CodePoint$fShowPartialUtf8CodePointisValidUtf8ByteStringHaskellisValidUtf8ByteArrayHaskellisValidUtf8ByteArrayIter unsafeHead unsafeTailiter iterArrayiter_ reverseIterreverseIterArray reverseIter_ lengthWord8 takeWord8 dropWord8 $fShowIterunpackCStringAscii#span_ spanAscii_runTextstreamLn reverseStream reverseScanrrestreamUtf16BErestreamUtf16LErestreamUtf32BErestreamUtf32LE streamUtf8 streamUtf16LE streamUtf16BE streamUtf32BE streamUtf32LE streamASCIIDecodingSomedecodeASCIIPrefix decodeASCII' decodeASCII decodeLatin1streamDecodeUtf8 decodeUtf8'decodeUtf8LenientencodeUtf8BuilderencodeUtf8BuilderEscapeddecodeUtf16LEWith decodeUtf16LEdecodeUtf16BEWith decodeUtf16BE encodeUtf16LE encodeUtf16BEdecodeUtf32LEWith decodeUtf32LEdecodeUtf32BEWith decodeUtf32BE encodeUtf32LE encodeUtf32BE$fShowDecodingI8fromPtrfromPtr0unsafeCopyToPtruseAsPtr asForeignPtr withCStringpeekCStringLen peekCStringwithCStringLen $fBoundedI8$fEnumI8$fEqI8 $fIntegralI8$fNumI8$fOrdI8$fReadI8$fRealI8$fShowI8:>:<Emptyunsnoc compareLength justifyLeft justifyRightcenter transposefoldr'scanl1scanr1 mapAccumR replicate measureOfftakeEnddropEnd takeWhileEnd dropWhileEnd dropAround stripStartstripEndstripsplitAtspanbreakspanMspanEndMgroupBygroupinitsinitsNEtailstailsNEsplitOnsplitchunksOf partitionbreakOn breakOnEnd breakOnAllcountzipwordslinesunlinesunwords isSuffixOf isInfixOf stripPrefixcommonPrefixes stripSuffixshowcopy$fPrintfArgText$fLiftBoxedRepText $fDataText $fBinaryText $fNFDataText $fIsListText$fIsStringText $fMonoidText$fSemigroupText $fReadText $fOrdText$fEqTextReaderdecimal hexadecimalsignedrationaldoubleLazyTextChunkstrictInvariant lazyInvariant showStructurechunk foldrChunks foldlChunksdefaultChunkSizesmallChunkSize chunkOverheadunstreamChunkstoChunkstoStrict fromStrictrepeatcycleiterate $fShowText hGetLineWith readChunk hPutStreamhPutStr hPutStrLn writeFile appendFile hGetContentshGetLineinteract getContentsgetLineputStrputStrLnLazyTextBuilder fromString fromLazyText toLazyTexttoLazyTextWithflush ensureFreewriteNappend' $fOrdBuilder $fEqBuilder $fShowBuilder$fIsStringBuilder$fMonoidBuilder$fSemigroupBuilderi2d<>FPFormatExponentFixedGeneric realFloatformatRealFloat$fEnumFPFormat$fReadFPFormat$fShowFPFormat$fBoundedFPFormat hGetChunkcompareInternalGHC.Internal.BaseStringGHC.Internal.MaybeNothingJustGHC.Internal.ErrerrorGHC.Internal.Exceptionthrowbetween measure_offGHC.Internal.STSTGHC.Internal.WordWord8text_GHC.Internal.Show GHC.TypesCharbytestring-0.12.2.0-d3f3Data.ByteString.Internal.Type ByteStringindices' c_reversereverseNonEmptyBetweenUnknowneqZip caseConvertTrue findIndicesIPartialUtf8CodePointpartialUtf8CodePointutf8CodePointState partUtf8Empty partUtf8LenpartUtf8CompleteLenpartUtf8UnsafeIndexpartUtf8UnsafeAppend partUtf8FoldrGHC.Internal.Num+GHC.Internal.ListaddrLen mapNonEmptytoCaseFoldNonEmptytoLowerNonEmptytoUpperNonEmptytoTitleNonEmptyfilter_stream'Data.ByteString.Lazy.InternalasciiPrefixLength cSizeToInt c_is_asciic_is_ascii_offset intToCSizeseqGHC.Internal.PtrPtr compareText replicateCharpurefindAIndexOrEndFalsesumP ghc-bignumGHC.Num.IntegerIntegerGHC.Internal.Text.ReadreadDouble indicesOne dropWords splitAtWordhPutStreamOrUtf8 writeCharBuf'.GHC.Internal.IO.Handle.TypesHandlechooseGoodBufferingGHC.Internal.IO.StdHandlesstdinstdout withBufferwithSize mapBuildermappendGHC.Internal.Float RealFloat floatToDigits readChunkEof