| Copyright | © 2022 Julian Ospald |
|---|---|
| License | MIT |
| Maintainer | Julian Ospald <[email protected]> |
| Stability | experimental |
| Portability | portable |
| Safe Haskell | None |
| Language | Haskell2010 |
Internal low-level utilities mostly for Word16, such as byte-array operations and other stuff not meant to be exported from Word16 module.
isSpace :: Word16 -> Bool Source
word16ToChar :: Word16 -> Char Source
Total conversion to char.
create :: Int -> (forall s. MBA s -> ST s ()) -> ShortByteString Source
asBA :: ShortByteString -> BA Source
| BA# ByteArray# |
| MBA# (MutableByteArray# s) |
newPinnedByteArray :: Int -> ST s (MBA s) Source
newByteArray :: Int -> ST s (MBA s) Source
copyByteArray :: BA -> Int -> MBA s -> Int -> Int -> ST s () Source
unsafeFreezeByteArray :: MBA s -> ST s BA Source
copyAddrToByteArray :: Ptr a -> MBA RealWorld -> Int -> Int -> ST RealWorld () Source
packCWString :: Ptr Word16 -> IO ShortByteString Source
O(n). Construct a new ShortByteString from a CWString. The resulting ShortByteString is an immutable copy of the original CWString, and is managed on the Haskell heap. The original CWString must be null terminated.
Since: os-string-0.10.10.0
packCWStringLen :: (Ptr Word16, Int) -> IO ShortByteString Source
O(n). Construct a new ShortByteString from a CWStringLen. The resulting ShortByteString is an immutable copy of the original CWStringLen. The ShortByteString is a normal Haskell value and will be managed on the Haskell heap.
Since: os-string-0.10.10.0
useAsCWString :: ShortByteString -> (Ptr Word16 -> IO a) -> IO a Source
O(n) construction. Use a ShortByteString with a function requiring a null-terminated CWString. The CWString is a copy and will be freed automatically; it must not be stored or used after the subcomputation finishes.
Since: os-string-0.10.10.0
useAsCWStringLen :: ShortByteString -> ((Ptr Word16, Int) -> IO a) -> IO a Source
O(n) construction. Use a ShortByteString with a function requiring a CWStringLen. As for useAsCWString this function makes a copy of the original ShortByteString. It must not be stored or used after the subcomputation finishes.
Since: os-string-0.10.10.0
newCWString :: ShortByteString -> IO (Ptr Word16) Source
O(n) construction. Use a ShortByteString with a function requiring a CWStringLen. As for useAsCWString this function makes a copy of the original ShortByteString. It must not be stored or used after the subcomputation finishes.
Since: os-string-0.10.10.0
moduleErrorIO :: String -> String -> IO a Source
moduleErrorMsg :: String -> String -> String Source
packWord16 :: [Word16] -> ShortByteString Source
packLenWord16 :: Int -> [Word16] -> ShortByteString Source
unpackWord16 :: ShortByteString -> [Word16] Source
packWord16Rev :: [Word16] -> ShortByteString Source
packLenWord16Rev :: Int -> [Word16] -> ShortByteString Source
Encode Word16 as little-endian.
Decode Word16 from little-endian.
word16ToLE# :: Word16# -> Word16# Source
word16FromLE# :: Word16# -> Word16# Source
setByteArray :: MBA s -> Int -> Int -> Int -> ST s () Source
copyMutableByteArray :: MBA s -> Int -> MBA s -> Int -> Int -> ST s () Source
createAndTrim :: Int -> (forall s. MBA s -> ST s (Int, a)) -> (ShortByteString, a) Source
Given the maximum size needed and a function to make the contents of a ShortByteString, createAndTrim makes the ShortByteString. The generating function is required to return the actual final size (<= the maximum size) and the result value. The resulting byte array is realloced to this size.
createAndTrim' :: Int -> (forall s. MBA s -> ST s Int) -> ShortByteString Source
createAndTrim'' :: Int -> (forall s. MBA s -> MBA s -> ST s (Int, Int)) -> (ShortByteString, ShortByteString) Source
findIndexOrLength :: (Word16 -> Bool) -> ShortByteString -> Int Source
findFromEndUntil :: (Word16 -> Bool) -> ShortByteString -> Int Source
Returns the length of the substring matching, not the index. If no match, returns 0.
assertEven :: ShortByteString -> ShortByteString Source
errorEmptySBS :: HasCallStack => String -> a Source
moduleError :: HasCallStack => String -> String -> a Source
© The University of Glasgow and others
Licensed under a BSD-style license (see top of the page).
https://downloads.haskell.org/~ghc/9.12.1/docs/libraries/os-string-2.0.7-3f43/System-OsString-Data-ByteString-Short-Internal.html