gsh/evaluator/formatter
The formatter module is responsible for cleaning up and beautifying
the output from the Gleam compiler and evaluator.
Because GSH works by compiling a temporary file behind the scenes, standard compiler output often includes noisy “unused variable” warnings or absolute file paths. This module parses that text, strips out the noise, replaces temporary file paths with “REPL”, and applies ANSI syntax highlighting.
Values
pub fn format_error(output: String) -> String
Processes the output of a failed code evaluation (compiler error or runtime crash).
Filters out warnings, trims whitespace, and most importantly, rewrites the
error trace so it doesn’t expose the temporary gsh_eval.gleam file path.
pub fn format_output(output: String) -> String
Processes the standard output of a successful code evaluation. It filters out any noisy compiler warnings, trims whitespace, and applies ANSI syntax highlighting so the result looks beautiful in the terminal.