flatparse-0.4.0.0: High-performance parsing from strict bytestrings
Safe HaskellSafe-Inferred
LanguageHaskell2010

FlatParse.Common.Assorted

Synopsis

Compatibility

Char predicates

isDigit :: Char -> Bool Source #

isDigit c = '0' <= c && c <= '9'

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

splitBytes :: [Word] -> ([Word], [Word]) Source #

UTF-8 conversions

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 #

Unwrap the Int# from an Int and apply it to the given function.