Skip to main content

normalize

Function normalize 

Source
pub fn normalize(icl: &str) -> Result<String>
Expand description

Normalize ICL text to canonical form

Pipeline: parse → normalize AST → serialize → compute hash

§Guarantees

  • Idempotent: normalize(normalize(x)) == normalize(x)
  • Deterministic: same input always produces same output
  • Semantic preserving: parse(normalize(x)) preserves all meaning

§Errors

Returns ParseError for invalid input or NormalizationError if the contract cannot be canonicalized.