Zed + Roc + Zig — My Stack Reference

A practical reference for using and learning Zed, Roc, and Zig together.


The big picture

ToolRoleWhat it’s for
ZedCode editor + AI agentWhere I write and edit code
RocHigh-level functional languageFriendly, fast application code
ZigSystems languageExplicit 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

AliasExpands toUse
rvroc versionVersion
rrroc runRun a file
rbroc buildBuild
rboroc build –optimizeOptimized build
rreplroc replREPL
rfmtroc formatFormat
rcheckroc checkType-check only

Zig

AliasExpands toUse
zvzig versionVersion
zrzig runRun a file
zbzig build-exeBuild (debug)
zbszig build-exe -O ReleaseSmallSmall binary
zbfzig build-exe -O ReleaseFastFast binary
zfmtzig fmtFormat
ztestzig testTests
zbuildzig buildProject build (zig init)
zbrzig build runBuild + run project

Zed

AliasExpands toUse
zzedOpen 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

DayFocus
1Zed shortcuts + agent on a real folder
2Roc REPL + hello / greet
3Roc lists + FizzBuzz
4Zig structs + try / errors
5Zig small CLI (args)
6Same tiny idea in Roc and Zig
7Notes + 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

ProjectLanguageSkills
Todo CLIRocI/O, lists, Results
File line counterZigArgs, files, errors
Same tool in bothRoc + ZigCompare styles
FizzBuzz / list drillsRoc REPLMap, filter, when
zig init appZigProject layout, zig build

Resources


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.