gleamunison/formatter

Opinionated formatter for gleamunison surface syntax (roadmap 9.2).

One rule, no configuration:

Formatting is a pure function of the parse tree, so it is idempotent by construction. Known normalizations: ; comments are dropped (the lexer discards them before layout), and ’x prints as (quote x).

Values

pub fn drops_comments(src: String) -> Bool

True when the source carries ; comments the formatter will drop — callers surface this as a warning, never silently.

pub fn format_source(
  src: String,
) -> Result(String, lexer.ParseError)

Format a whole source file: every top-level form on its own line(s), forms separated by single newlines, trailing newline at the end.

✨ Search Document