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,\tand\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. .lencounts characters, and==compares texts exactly, case and spaces included.- For a prelude function
f, or your own,t.f(args)is the callf(t, args); chain such calls:typed.trim.to_upper. sliceneeds positions inside the text, andreplacea pattern that is not empty: the checker proves both at every call.- A condition is a
Bool: compare, then join withand,orandnot; the right side ofandruns, and is proved, only when the left side holds. if c then a else bchooses a value: both branches have one type,elseis required, and thethenbranch knows thatcholds.
3.9.3 Reference
- Construct pages: literals and operators, built-in types,
letandif,example - Guides: work with text
- Standard library: the prelude (
Text,Bool,trim,starts_with,is_digits), text (slice,replace,contains_text,ends_with,to_upper,to_lower,trim_start,trim_end), the built-in methods (.len) - Diagnostics: U0004, U0005, U0006, U0007, U0101, U2001, U5001
- Specification: lexical structure, grammar, types, core IR, verification, the standard library, text
Next:4 Kinds