Website rebuilt from scratch based on analysis of 11 beloved language websites (Elm, Zig, Gleam, Swift, Kotlin, Haskell, OCaml, Crystal, Roc, Rust, Go). New website structure: - Homepage with hero, playground, three pillars, install guide - Language Tour with interactive lessons (hello world, types, effects) - Examples cookbook with categorized sidebar - API documentation index - Installation guide (Nix and source) - Sleek/noble design (black/gold, serif typography) Also includes: - New stdlib/json.lux module for JSON serialization - Enhanced stdlib/http.lux with middleware and routing - New string functions (charAt, indexOf, lastIndexOf, repeat) - LSP improvements (rename, signature help, formatting) - Package manager transitive dependency resolution - Updated documentation for effects and stdlib - New showcase example (task_manager.lux) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Task Manager Showcase
This example demonstrates Lux's three killer features in a practical, real-world context.
Running the Example
lux run examples/showcase/task_manager.lux
Features Demonstrated
1. Algebraic Effects
Every function signature shows exactly what side effects it can perform:
fn createTask(title: String, priority: String): Task@latest
with {TaskStore, Random} = { ... }
TaskStore- database operationsRandom- random number generation- No hidden I/O or surprise calls
2. Behavioral Types
Compile-time guarantees about function behavior:
fn formatTask(task: Task@latest): String
is pure // No side effects
is deterministic // Same input = same output
is total // Always terminates
fn completeTask(id: String): Option<Task@latest>
is idempotent // Safe to retry
with {TaskStore}
3. Schema Evolution
Versioned types with automatic migration:
type Task @v2 {
id: String,
title: String,
done: Bool,
priority: String, // New in v2
from @v1 = { ...old, priority: "medium" }
}
4. Handler Swapping (Testing)
Test without mocks by swapping effect handlers:
// Production
run processOrders() with {
TaskStore = PostgresTaskStore,
Logger = CloudLogger
}
// Testing
run processOrders() with {
TaskStore = InMemoryTaskStore,
Logger = SilentLogger
}
Why This Matters
| Traditional Languages | Lux |
|---|---|
| Side effects are implicit | Effects in type signatures |
| Runtime crashes | Compile-time verification |
| Complex mocking frameworks | Simple handler swapping |
| Manual migration code | Automatic schema evolution |
| Hope for retry safety | Verified idempotency |
File Structure
showcase/
├── README.md # This file
└── task_manager.lux # Main example with all features
Key Sections in the Code
- Versioned Data Types -
Task @v1,@v2,@v3with migrations - Pure Functions -
is pure,is total,is deterministic,is idempotent - Effects -
effect TaskStoreandeffect Logger - Effect Handlers -
InMemoryTaskStore,ConsoleLogger - Testing -
runTestScenario()with swapped handlers - Migration Demo -
demonstrateMigration()
Next Steps
- Read the Behavioral Types Guide
- Read the Schema Evolution Guide
- Explore more examples