unicode-normalization-0.1: Unicode normalization using the ICU librarySource codeContentsIndex
This module contains basal stuff for the CompactString ICU bindings. The real functionality is in other modules.
type UChar = Word16
type UErrorCode = CInt
type UBool = CChar
uBoolToBool :: UBool -> Bool
class BitPackable a where
intValue :: a -> Int32
packOptions :: [a] -> Int32
withPackedOptions :: [a] -> (Int32 -> IO b) -> IO b
withCompactString :: CompactString UTF16Native -> (Ptr UChar -> Int32 -> IO a) -> IO a
handleError :: (Ptr UErrorCode -> IO a) -> IO a
cOrderingToOrdering :: Integral a => a -> Ordering
type UChar = Word16Source
The ICU character type. A UChar is a 16-bit unit of a UTF-16 encoded string
type UErrorCode = CIntSource
The internal ICU error code type.
type UBool = CCharSource
The internal ICU boolean type. See unicode/umachine.h. Be aware that to Haskell, this is a numeric type and not a boolean.
uBoolToBool :: UBool -> BoolSource
Converts an ICU bool to a Haskell one, preserving truth or falsehood.
class BitPackable a whereSource
A type class for all option types, for which we want to turn a list of options into a bit field.
intValue :: a -> Int32Source
Tells of a certain option what its C integer/enum value is.
packOptions :: [a] -> Int32Source
Takes a list of options and encodes it into a C integer.
withPackedOptions :: [a] -> (Int32 -> IO b) -> IO bSource
Runs a function, expecting a 32-bit integer, with the given options bit-packed into a 32-bit integer.
show/hide Instances
withCompactString :: CompactString UTF16Native -> (Ptr UChar -> Int32 -> IO a) -> IO aSource
Runs a raw ICU-type function on a CompactString encoded in UTF16. The ICU-type function has type Ptr UChar -> Int32 -> a. This function may not modify the memory under the Ptr UChar. The size of the Ptr UChar in 16-bit words is passed in as the Int32 argument. Accessing memory from Ptr UChar outside of that size also sends us off to lala land, of course.
handleError :: (Ptr UErrorCode -> IO a) -> IO aSource

Provides simple (i.e. abort-if-anything-wrong) error handling for ICU functions.

Takes as an argument a function that writes an ICU error code to a certain memory address (like most ICU4C functions do).

This function runs the given function, giving it a memory address to write the error code to. When the given function indicates an error, it aborts the program. Otherwise it just returns the result.

cOrderingToOrdering :: Integral a => a -> OrderingSource
Converts a C ordering (-1 means LT, 0 means EQ, 1 means GT) to a Haskell ordering.
Produced by Haddock version 2.4.2