Home / Learn / 3 Text and conditions

Release v0.4.0Edition 0.2

3.9 Recap and reference

Page 10 of 10

3.9.1 For agents

una --json check . prints each diagnostic with its code, message, primary span and repairs; a refuted obligation, U5001, also carries its obligation and a counterexample, and its repairs, from a guard to a requires, are descriptions only. U0007 carries an exact edit, which una fix . applies; the U0101s, U0006 and U2001 are repaired by hand, since the right form is the author's choice. The compact rule: join texts with interpolation, never +; name a text literal before it goes in braces; a condition is a Bool, and comparisons do not chain; a one-line if has else and branches of one type; guard a slice or a division with if or and.

3.9.2 Recap

  • A text is written between double quotes on one line; \", \\, \{, \}, \n, \t and \u{…} are its escapes.
  • Build a text from values with interpolation, "{units} x {sku}"; there is no + for texts, and no text literal inside the braces.
  • .len counts characters, and == compares texts exactly, case and spaces included.
  • For a prelude function f, or your own, t.f(args) is the call f(t, args); chain such calls: typed.trim.to_upper.
  • slice needs positions inside the text, and replace a pattern that is not empty: the checker proves both at every call.
  • A condition is a Bool: compare, then join with and, or and not; the right side of and runs, and is proved, only when the left side holds.
  • if c then a else b chooses a value: both branches have one type, else is required, and the then branch knows that c holds.

3.9.3 Reference

Next:4 Kinds