Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- shortInteger :: Int# -> Integer
- isDigit :: Char -> Bool
- isLatinLetter :: Char -> Bool
- isGreekLetter :: Char -> Bool
- packBytes :: [Word] -> Word
- splitBytes :: [Word] -> ([Word], [Word])
- charToBytes :: Char -> [Word]
- strToBytes :: String -> [Word]
- strToUtf8 :: String -> ByteString
- utf8ToStr :: ByteString -> String
- derefChar8# :: Addr# -> Char#
- word16ToInt16 :: Word16 -> Int16
- word32ToInt32 :: Word32 -> Int32
- word64ToInt64 :: Word64 -> Int64
- withPosInt# :: Int# -> r -> r
- withIntUnwrap# :: (Int# -> r) -> Int -> r
- zbytel :: (FiniteBits a, Num a) => a -> Int
- zbytel'intermediate :: (FiniteBits a, Num a) => a -> a
- zbytel'toIdx :: (FiniteBits a, Num a) => a -> Int
- zbyter :: (FiniteBits a, Num a) => a -> Int
- zbyter'intermediate :: (FiniteBits a, Num a) => a -> a
- zbyter'toIdx :: (FiniteBits a, Num a) => a -> Int
Compatibility
shortInteger :: Int# -> Integer Source #
Char
predicates
isLatinLetter :: Char -> Bool Source #
isLatinLetter c = ('A' <= c && c <= 'Z') || ('a' <= c && c <= 'z')
isGreekLetter :: Char -> Bool Source #
isGreekLetter c = ('Α' <= c && c <= 'Ω') || ('α' <= c && c <= 'ω')
Other
UTF-8 conversions
charToBytes :: Char -> [Word] Source #
strToBytes :: String -> [Word] Source #
strToUtf8 :: String -> ByteString Source #
Convert an UTF8-encoded String
to a ByteString
.
utf8ToStr :: ByteString -> String Source #
Convert a ByteString
to an UTF8-encoded String
.
Shortcuts
derefChar8# :: Addr# -> Char# Source #
Shortcut for 'indexCharOffAddr# addr# 0#'.
Boxed integer coercions
These functions should be no-ops. They correspond to the similarly-named GHC 9.4 primops which work on unboxed integers.
Helpers
withPosInt# :: Int# -> r -> r Source #
Assert for the given Int#
that n >= 0
.
Throws a runtime error if given a negative integer.
withIntUnwrap# :: (Int# -> r) -> Int -> r Source #
Bit manipulation
zbytel :: (FiniteBits a, Num a) => a -> Int Source #
Index of leftmost null byte, or (number of bytes in type) if not present.
Adapted from Hacker's Delight 6-1. Useful in big-endian environments.
zbytel'intermediate :: (FiniteBits a, Num a) => a -> a Source #
bit mangling, returns 0 for inputs without a null byte
Separating allows us to skip some index calculation if there was no null byte.
zbytel'toIdx :: (FiniteBits a, Num a) => a -> Int Source #
bit mangling, turns intermediate value into an index
Separating allows us to skip some index calculation if there was no null byte.
zbyter :: (FiniteBits a, Num a) => a -> Int Source #
Index of rightmost null byte, or (number of bytes in type) if not present
Adapted from Hacker's Delight 6-1. Useful in little-endian environments.
zbyter'intermediate :: (FiniteBits a, Num a) => a -> a Source #
bit mangling, returns 0 for inputs without a null byte
Separating allows us to skip some index calculation if there was no null byte.
zbyter'toIdx :: (FiniteBits a, Num a) => a -> Int Source #
bit mangling, turns intermediate value into an index
Separating allows us to skip some index calculation if there was no null byte.