Hoogle Search
Within LTS Haskell 24.39 (ghc-9.10.3)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
validate4 :: Word8 -> Word8 -> Word8 -> Word8 -> Booltext Data.Text.Internal.Encoding.Utf8 No documentation available.
module Data.Text.Internal.
Validate Test whether or not a sequence of bytes is a valid UTF-8 byte sequence. In the GHC Haskell ecosystem, there are several representations of byte sequences. The only one that the stable text API concerns itself with is ByteString. Part of bytestring-to-text decoding is isValidUtf8ByteString, a high-performance UTF-8 validation routine written in C++ with fallbacks for various platforms. The C++ code backing this routine is nontrivial, so in the interest of reuse, this module additionally exports functions for working with the GC-managed ByteArray type. These ByteArray functions are not used anywhere else in text. They are for the benefit of library and application authors who do not use ByteString but still need to interoperate with text.
isValidUtf8ByteArray :: ByteArray -> Int -> Int -> Booltext Data.Text.Internal.Validate 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.
isValidUtf8ByteArrayPinned :: ByteArray -> Int -> Int -> Booltext Data.Text.Internal.Validate This uses the safe FFI. GC may run concurrently with safe FFI calls. Consequently, unpinned objects may be relocated while a safe 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.
isValidUtf8ByteArrayUnpinned :: ByteArray -> Int -> Int -> Booltext Data.Text.Internal.Validate 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.
isValidUtf8ByteString :: ByteString -> Booltext Data.Text.Internal.Validate Is the ByteString a valid UTF-8 byte sequence?
isValidUtf8ByteArrayHaskell :: ByteArray -> Int -> Int -> Booltext Data.Text.Internal.Validate.Native Native implementation of isValidUtf8ByteArrayUnpinned and isValidUtf8ByteArrayPinned.
isValidUtf8ByteStringHaskell :: ByteString -> Booltext Data.Text.Internal.Validate.Native Native implementation of isValidUtf8ByteString.
runIdentity :: Identity a -> acontainers Data.Map.Internal No documentation available.
showWide :: Bool -> [String] -> String -> Stringcontainers Data.Map.Internal.Debug No documentation available.