yamlet
Safe HaskellNone
LanguageGHC2021

Yamlet.Internal.Utils

Description

Helpers for the other modules.

This module is intended for internal use only, and may change without warning in subsequent releases.

Synopsis

Documentation

textStripPrefix :: Text -> Text -> Maybe Text Source #

stripPrefix. Before text 2.1.4, stripPrefix compares the texts as streams of characters and allocates for each character. For these versions this is the code of text 2.1.4, which compares the UTF-8 bytes.

textIsPrefixOf :: Text -> Text -> Bool Source #

isPrefixOf, with the code of text 2.1.4 as in textStripPrefix.

maxImplicitKeyLength :: Int Source #

The largest number of characters of an implicit key, from the YAML 1.2.2 specification.

maxVersion :: Int Source #

The largest number in a version of a %YAML directive.

Without a limit, the largest number depends on the size of Int, which differs between architectures. The limit is far above any version of YAML, and a number below it times 10 fits in 32 bits.

minExpansion :: Int Source #

The size that an expansion of a small input can always add: the visits that aliases add to a traversal, or the bytes that the prefixes of %TAG directives add to the tags. A larger input can add as much as it has.

A traversal of 100000 nodes takes about 5 ms and 6 MB, measured with a copy of the nodes. go-yaml allows about 400000 nodes from aliases in a small document.

coreTagPrefix :: Text Source #

The prefix of the tags of the core schema, and of the !! handle.

picoDecimals :: Int Source #

The number of decimal places of Pico, the resolution of the durations of the time library.

decimalPlaces :: Integer -> Maybe Int Source #

The number of decimal places of 1n, or Nothing if 1n has no finite decimal form. It has one if n is 2^a * 5^b, and then it needs max a b places.

isHighSurrogate :: Int -> Bool Source #

The first code unit of a surrogate pair of UTF-16.

isLowSurrogate :: Int -> Bool Source #

The second code unit of a surrogate pair of UTF-16.

fromSurrogates :: Int -> Int -> Int Source #

The code point of a surrogate pair, by the formula of UTF-16.

isScalarValue :: Int -> Bool Source #

A code point that a character can have: in the range of Unicode, and not a surrogate.

xEscapeDigits :: Int Source #

The number of hex digits of the \x, \u and \U escapes of a double-quoted scalar.

uEscapeDigits :: Int Source #

The number of hex digits of the \x, \u and \U escapes of a double-quoted scalar.

bigUEscapeDigits :: Int Source #

The number of hex digits of the \x, \u and \U escapes of a double-quoted scalar.

percentDigits :: Int Source #

The number of hex digits of a %XX escape in a tag.

showText :: Text -> String Source #

The text in double quotes for a message, with the escapes of a double-quoted scalar for a quote, a backslash and a character that does not print, so that the message stays on one line. Unlike show, it keeps the other characters that are not ASCII, e.g. "zażółć".

strictPair :: a -> b -> (a, b) Source #

A pair with both components evaluated.

strictMap :: (a -> b) -> [a] -> [b] Source #

map with the spine and the elements of the result evaluated. The results are in reverse until the end, so that the stack does not grow with the length of the list.

firstOfResult :: Either e (a, b) -> Either e a Source #

The first component of a pair in a result. Unlike fmap fst, it gives no selector thunk inside the result.