The Show protocol: convert values to their human-readable String form.

This is the counterpart of Elixir's String.Chars / Inspect split: show/1 produces a representation suitable for debugging and log output. Strings are wrapped in quotes, atoms are prefixed with :; callers that want raw text should use Std.String.from_* instead.

Examples

cure
use Std.Show

show(42)                                # => "42"
show("hi")                              # => "\"hi\""
show(:ok)                               # => ":ok"
show_line(true)                         # => "true\n"

Group tag consumed by Cure.Stdlib.Preload. String is nominal, not a List(Char) alias; its module supplies the type the signatures below name. <> in the instance bodies desugars to Std.Semigroup.combine, so that interface must be in scope too.

Functions

  • # fn show_line(x: t) -> String

    Same as show/1 but append a trailing newline. Useful for logging. The requires Show(t) constraint threads the dictionary that dispatches show at the caller's type.