ivory-stdlib-0.1.0.3: Ivory standard library.

Safe HaskellNone
LanguageHaskell2010

Ivory.Stdlib.String

Synopsis

Documentation

stdlibStringModule :: Module Source

Ivory module definition.

stringInit :: IvoryString str => String -> Init str Source

String initialization. Error returned if the String is too large.

istr_eq :: (IvoryString str1, IvoryString str2) => ConstRef s1 str1 -> ConstRef s2 str2 -> Ivory eff IBool Source

Compare strings (of possibly different types) for equality. Returns true if the strings are the same length and contain the same bytes.

sz_from_istr :: (ANat len, IvoryString str) => Ref s1 (Array len (Stored Uint8)) -> ConstRef s2 str -> Ivory eff () Source

Copy an Ivory string to a fixed-size, null-terminated C string. The destination string is always properly terminated, but may be truncated if the buffer is too small.

FIXME: This should return false if the string was truncated.

istr_len :: IvoryString str => ConstRef s str -> Ivory eff Len Source

Return the length of a string.

istr_from_sz :: (ANat len, IvoryString str) => Ref s1 str -> ConstRef s2 (Array len (Stored Uint8)) -> Ivory eff () Source

Copy the contents of a fixed-size C string into an Ivory string. If the source string is not null terminated (and therefore corrupt), this will copy no more than len characters.

FIXME: This should return false if the string was truncated.

istr_copy :: IvoryString str => Ref s1 str -> ConstRef s2 str -> Ivory eff () Source

Copy one string into another of the same type.

string_lit_store :: IvoryString str => String -> Ref s str -> Ivory eff () Source

Store a constant string into an IvoryString. Error returned if the String is too large.

string_lit_array :: ANat n => String -> Ref s (Array n (Stored Uint8)) -> Ivory eff () Source

Copy a Haskell string directly to an array of uint8s.