A practical reference for using and learning Zed, Roc, and Zig together.
The big picture
| Tool | Role | What it’s for |
|---|---|---|
| Zed | Code editor + AI agent | Where I write and edit code |
| Roc | High-level functional language | Friendly, fast application code |
| Zig | Systems language | Explicit control, tiny binaries, and the language Roc’s compiler is written in |
Mental model:
text
Zed (editor)
├── I write Roc code → Roc compiler (written in Zig) → native binary
└── I write Zig code → Zig compiler → native binary
- Zed = workspace
- Roc = high-level language
- Zig = low-level language and the implementation language of Roc’s compiler
No virtual environments required for Roc or Zig. Both compilers live on PATH and work from any directory.
Setup (Debian / Linux)
Zed — installed from zed.dev; launch with zed or aliases below.
Roc
Bash
curl --proto '=https' --tlsv1.2 -sSf https://roc-lang.org/install_roc.sh | sh
source ~/.bashrc
roc version
Zig — official Linux binary on PATH (e.g. under /opt/zig):
Bash
zig version # e.g. 0.14.0
Anthropic in Zed (Free plan) Settings → AI → LLM Providers → Anthropic (or ANTHROPIC_API_KEY in the environment). Agent panel: message the agent, @ for context, / for commands.
Aliases (quick reference)
Add to ~/.bashrc, then source ~/.bashrc.
Roc
| Alias | Expands to | Use |
|---|---|---|
| rv | roc version | Version |
| rr | roc run | Run a file |
| rb | roc build | Build |
| rbo | roc build –optimize | Optimized build |
| rrepl | roc repl | REPL |
| rfmt | roc format | Format |
| rcheck | roc check | Type-check only |
Zig
| Alias | Expands to | Use |
|---|---|---|
| zv | zig version | Version |
| zr | zig run | Run a file |
| zb | zig build-exe | Build (debug) |
| zbs | zig build-exe -O ReleaseSmall | Small binary |
| zbf | zig build-exe -O ReleaseFast | Fast binary |
| zfmt | zig fmt | Format |
| ztest | zig test | Tests |
| zbuild | zig build | Project build (zig init) |
| zbr | zig build run | Build + run project |
Zed
| Alias | Expands to | Use |
|---|---|---|
| z | zed | Open editor |
| z. | zed . | Open current folder |
| zed. | zed . | Same as z. |
Examples
Bash
rv
zr hello.zig
zbs hello.zig # → often ~7K for hello world
z.
rrepl
Where commands work
- zig / roc / zed — any directory (on PATH)
- Running a program — need the file in the current dir or a path: zig run hello.zig or zig run ~/hello.zig
Hello World (both languages)
Zig
zig
const std = @import("std");
pub fn main() !void {
const stdout = std.io.getStdOut().writer();
try stdout.print("Hello, Zig!\n", .{});
}
Bash
zig run hello.zig
zig build-exe hello.zig -O ReleaseSmall # tiny binary
Roc (new Zig-based compiler)
roc
main! = |_args| {
echo!("Hello, World!")
Ok({})
}
Bash
roc hello.roc
Roc REPL
Bash
roc repl
# |n| n * 2
# List.map([1, 2, 3], |n| n * 2) → [2.0, 4.0, 6.0]
Note: new compiler uses |args| body, not \n -> ….
Learning plan
Day 1
- Confirm: rv, zv, z, z.
- Zed: Ctrl+P, Ctrl+Shift+P, terminal, agent panel
- Zig: zig run hello.zig + zbs hello.zig
- Roc: roc hello.roc + 10 minutes in rrepl
- Optional: install Roc extension in Zed
Week 1
| Day | Focus |
|---|---|
| 1 | Zed shortcuts + agent on a real folder |
| 2 | Roc REPL + hello / greet |
| 3 | Roc lists + FizzBuzz |
| 4 | Zig structs + try / errors |
| 5 | Zig small CLI (args) |
| 6 | Same tiny idea in Roc and Zig |
| 7 | Notes + pick one mini project |
Month 1
Weeks 1–2 — Roc
- REPL daily
- Lists, records, when, Result
- Small CLIs and file-oriented scripts
- New-compiler mini tutorial
Weeks 2–3 — Zig
- Allocators, error unions, structs
- zig init projects
- ReleaseSmall vs debug
- One small file-processing CLI
Week 4 — Combine
- Same tool in Roc and Zig
- Heavy use of Zed agent for explain / refactor
- Short write-up of what felt fast vs what felt explicit
Ongoing
- One focused session most days (30–60 min)
- Prefer trying before asking the agent
- Alternate “friendly” (Roc) and “explicit” (Zig) days
- Optional later: Roc platforms, Zig↔Roc boundaries
Suggested mini projects
| Project | Language | Skills |
|---|---|---|
| Todo CLI | Roc | I/O, lists, Results |
| File line counter | Zig | Args, files, errors |
| Same tool in both | Roc + Zig | Compare styles |
| FizzBuzz / list drills | Roc REPL | Map, filter, when |
| zig init app | Zig | Project layout, zig build |
Resources
- Zed: zed.dev/docs, in-app Settings → AI
- Roc: New-compiler mini tutorial, roc-lang.org (some examples still use old syntax)
- Zig: ziglang.org/learn, language reference
One-line summary
Zed is where I work; Roc is how I write friendly, fast programs; Zig is how I write explicit systems code — and it’s also what compiles Roc. Aliases keep the loop short; a simple day → week → month plan turns the stack into a real skill.