1. Install wcl and check your first file

Get the toolchain running, write a tiny typed document, and check and evaluate it.

After this lesson you can

- Install the wcl binary and verify it runs - Write a minimal document: a @document type plus a few fields - Validate with wcl check and read a value with wcl eval

WCL ships as one binary, wcl. Install the newest pre-release with the install script (curl -fsSL https://wcl.dev/install.sh | sh -s -- --pre), or build from source with Cargo, then confirm wcl --version prints a version.

The smallest useful document has two halves: a @document type that says which top-level fields are legal, and the fields themselves. That split is the whole idea of WCL in miniature — data plus the schema that validates it, in one file. wcl check gates on the schema (exit 0 = valid), and wcl eval resolves a named field to its value.

§ 1Exercise: A first checked document

Write a three-field document with its schema, validate it, then read one field back.

bash
cat > hello.wcl <<'WCL'
@document
type Hello {
  name:    utf8
  count:   u32
  enabled: bool
}

name    = "world"
count   = 3u32
enabled = true
WCL
wcl check hello.wcl
wcl eval hello.wcl count

Expected result

wcl check prints OK, and wcl eval hello.wcl count prints 3u32.

Hint

Every top-level field must be declared by a @document schema — delete the count: line from the type and wcl check reports exactly that.