View Source cure_show_native (cure v0.1.0)

Native Erlang implementations of Show trait functions for Cure.

Provides efficient primitive-to-string conversions for the Show trait system.

Summary

Functions

Convert an atom to its string representation.

Convert a boolean to its string representation.

Escape special characters in a string and wrap in quotes.

Convert a float to its string representation.

Convert an integer to its string representation.

Check if value is an atom (for Cure pattern guards).

Check if value is a boolean (for Cure pattern guards).

Check if value is a float (for Cure pattern guards).

Check if value is an integer (for Cure pattern guards).

Check if value is a list (for Cure pattern guards).

Check if value is a string/binary (for Cure pattern guards).

Check if value is a tuple (for Cure pattern guards).

Convert a list to its string representation.

Convert list elements to comma-separated string representations.

Convert a tuple to its string representation. Only handles tuples up to size 5 for now.

Functions

atom_to_string(Atom)

-spec atom_to_string(atom()) -> binary().

Convert an atom to its string representation.

bool_to_string/1

-spec bool_to_string(boolean()) -> binary().

Convert a boolean to its string representation.

escape_string(Str)

-spec escape_string(binary()) -> binary().

Escape special characters in a string and wrap in quotes.

float_to_string(Float)

-spec float_to_string(float()) -> binary().

Convert a float to its string representation.

int_to_string(Int)

-spec int_to_string(integer()) -> binary().

Convert an integer to its string representation.

is_atom_value(Val)

-spec is_atom_value(term()) -> boolean().

Check if value is an atom (for Cure pattern guards).

is_bool_value/1

-spec is_bool_value(term()) -> boolean().

Check if value is a boolean (for Cure pattern guards).

is_float_value(Val)

-spec is_float_value(term()) -> boolean().

Check if value is a float (for Cure pattern guards).

is_integer_value(Val)

-spec is_integer_value(term()) -> boolean().

Check if value is an integer (for Cure pattern guards).

is_list_value(Val)

-spec is_list_value(term()) -> boolean().

Check if value is a list (for Cure pattern guards).

is_string_value(Val)

-spec is_string_value(term()) -> boolean().

Check if value is a string/binary (for Cure pattern guards).

is_tuple_value(Val)

-spec is_tuple_value(term()) -> boolean().

Check if value is a tuple (for Cure pattern guards).

show_list/1

-spec show_list(list()) -> binary().

Convert a list to its string representation.

show_list_elements/1

-spec show_list_elements(list()) -> binary().

Convert list elements to comma-separated string representations.

show_tuple/1

-spec show_tuple(tuple()) -> binary().

Convert a tuple to its string representation. Only handles tuples up to size 5 for now.