Compiler.Ast.Compare

Position-independent AST comparison for two parsed Gren modules.

compareModules : Module -> Module -> Result String {}

Compare two parsed modules for semantic equivalence. Returns Ok {} when the modules agree on name, exports, imports, declarations, and effects (ignoring source positions and parse-context comments), or Err with a description of the first difference encountered.

exports and imports are compared order-independently (each side is canonicalized by sorting before the pairwise comparison): the formatter (Formatter.Logical.SortSymbols) deliberately reorders the contents of an exposing ( ... ) list, and reorders import statements within a contiguous, blank-line/comment-free run of them -- neither order is part of Gren's program semantics. Every other array compared here stays positional, since those genuinely are order-sensitive (function arguments, union constructors, declaration bodies, ...).