docs: update documentation to match current implementation

- SKILLS.md: Update roadmap phases with actual completion status
  - Phase 0-1 complete, Phase 2-5 partial, resolved design decisions
- OVERVIEW.md: Add HttpServer, Test effect, JIT to completed features
- ROADMAP.md: Add HttpServer, Process, Test effects to done list
- VISION.md: Update Phase 2-3 tables with current status
- guide/05-effects.md: Add Time, HttpServer, Test to effects table
- guide/09-stdlib.md: Add HttpServer, Time, Test effect docs
- reference/syntax.md: Fix interpolation syntax, remove unsupported literals
- testing.md: Add native Test effect documentation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-14 02:56:42 -05:00
parent c81349d82c
commit 8c7354131e
8 changed files with 220 additions and 93 deletions

View File

@@ -362,19 +362,25 @@ Values + Effects Native Code
## Future Roadmap
**Complete:**
- ✅ Standard Library (List, String, Option, Result, JSON)
- ✅ Module System (imports, exports, aliases)
- ✅ LSP Server (basic diagnostics, hover, completions)
- ✅ Standard Library (List, String, Option, Result, Math, JSON)
- ✅ Module System (imports, exports, aliases, selective imports)
- ✅ LSP Server (diagnostics, hover, completions)
- ✅ Generics and String Interpolation
- ✅ File/HTTP/Random/Time Effects
- ✅ File/HTTP/Random/Time/Process Effects
- ✅ HTTP Server Effect (listen, accept, respond, stop)
- ✅ Test Effect (native testing framework)
- ✅ Console.readLine and Console.readInt
- ✅ JIT Compiler for numeric code (~160x speedup)
- ✅ Watch mode / hot reload
- ✅ Formatter
**In Progress:**
1. **Behavioral Type Verification** - Total, idempotent, deterministic checking
2. **Schema Evolution** - Type system integration, auto-migration
3. **Error Message Quality** - Elm-style suggestions
3. **Error Message Quality** - Context lines shown, suggestions partial
**Planned:**
4. **HTTP Server Effect** - Build web APIs
5. **SQL Effect** - Database access
6. **Package Manager** - Share code
7. **JavaScript Backend** - Run in browsers
4. **SQL Effect** - Database access
5. **Package Manager** - Share code (manifest parsing exists)
6. **JavaScript Backend** - Run in browsers
7. **Full JIT** - Strings, lists, ADTs, effects

View File

@@ -273,10 +273,13 @@
**Effect System:**
- ✅ Effect declarations and handlers
- ✅ Console effect (print, readLine, readInt)
- ✅ File effect (read, write, exists, delete, listDir)
- ✅ HTTP effect (get, post)
- ✅ File effect (read, write, exists, delete, listDir, mkdir)
- ✅ HTTP client effect (get, post, put, delete)
- ✅ HTTP server effect (listen, accept, respond, stop)
- ✅ Process effect (exec, env, args, cwd, exit)
- ✅ Random effect (int, float, range, bool)
- ✅ Time effect (now, sleep)
- ✅ Test effect (assert, assertEqual, assertTrue, assertFalse)
**Module System:**
- ✅ Imports, exports, aliases
@@ -285,9 +288,12 @@
- ✅ Circular dependency detection
**Standard Library:**
- ✅ String operations
- ✅ List operations
-JSON parsing/serialization
- ✅ String operations (split, join, trim, contains, replace, toUpper, toLower, etc.)
- ✅ List operations (map, filter, fold, head, tail, concat, reverse, find, etc.)
-Option operations (map, flatMap, getOrElse, isSome, isNone)
- ✅ Result operations (map, flatMap, getOrElse, isOk, isErr)
- ✅ Math operations (abs, min, max, sqrt, pow, floor, ceil, round)
- ✅ JSON parsing/serialization (parse, stringify, get, object, array)
**Tooling:**
- ✅ JIT compiler (~160x speedup, CLI: `lux compile`)

View File

@@ -124,25 +124,29 @@ fn retry<F>(action: F, times: Int): Result
| REPL | Done | Interactive development |
| Type Checking | Done | With effect tracking |
### Needed for Real Use (Phase 2: Practical)
### Completed (Phase 2: Practical)
| Feature | Effort | Why It Matters |
|---------|--------|----------------|
| **Module System** | Done | Imports, exports, aliases, selective imports |
| **Standard Library** | Done | List.map, String.split, Option.map, etc. |
| **File/Network Effects** | 1-2 weeks | Real IO beyond Console |
| **Better Error Messages** | 2-3 weeks | Elm-quality diagnostics |
| **Full Compilation** | 4-6 weeks | Cranelift JIT exists for numeric code; needs strings, ADTs, effects |
| Feature | Status | Notes |
|---------|--------|-------|
| **Module System** | Done | Imports, exports, aliases, selective imports |
| **Standard Library** | Done | List, String, Option, Result, Math, Json modules |
| **File Effect** | ✅ Done | read, write, exists, delete, listDir, mkdir |
| **HTTP Client Effect** | ✅ Done | get, post, put, delete |
| **HTTP Server Effect** | ✅ Done | listen, accept, respond, stop |
| **Process Effect** | ✅ Done | exec, env, args, cwd, exit |
| **Random/Time Effects** | ✅ Done | int, float, bool, now, sleep |
| **JIT Compiler** | ✅ Partial | Numeric code ~160x faster, strings/ADTs pending |
| **Error Messages** | ✅ Partial | Context lines shown, suggestions improving |
### Needed for Full Vision (Phase 3: Differentiation)
### In Progress (Phase 3: Differentiation)
| Feature | Effort | Why It Matters |
|---------|--------|----------------|
| **Schema Evolution** | 4-6 weeks | The versioned types system |
| **Behavioral Types** | 4-6 weeks | is pure, is idempotent, etc. |
| **Effect Tracing/Debugging** | 2-3 weeks | Elm-like debugging |
| **LSP Server** | 3-4 weeks | IDE support |
| **Package Manager** | 2-3 weeks | Share code |
| Feature | Status | Notes |
|---------|--------|-------|
| **Schema Evolution** | ⚠️ Partial | Parsing done, type integration pending |
| **Behavioral Types** | ⚠️ Partial | Parsing done, verification pending |
| **LSP Server** | ✅ Done | Diagnostics, hover, completions working |
| **Package Manager** | ⚠️ Partial | Manifest parsing exists |
| **Effect Tracing** | Planned | Elm-like debugging |
---

View File

@@ -48,9 +48,12 @@ Lux provides several built-in effects:
| `Fail` | `fail` | Early termination |
| `State` | `get`, `put` | Mutable state |
| `Random` | `int`, `float`, `bool` | Random numbers |
| `File` | `read`, `write`, `exists` | File system |
| `Process` | `exec`, `env`, `args` | System processes |
| `Time` | `now`, `sleep` | Time operations |
| `File` | `read`, `write`, `exists`, `delete`, `list`, `mkdir` | File system |
| `Process` | `exec`, `env`, `args`, `cwd`, `exit` | System processes |
| `Http` | `get`, `post`, `put`, `delete` | HTTP client |
| `HttpServer` | `listen`, `accept`, `respond`, `stop` | HTTP server |
| `Test` | `assert`, `assertEqual`, `assertTrue`, `assertFalse` | Testing |
Example usage:

View File

@@ -260,6 +260,34 @@ fn example(): Unit with {Http} = {
}
```
### HttpServer
```lux
fn example(): Unit with {HttpServer, Console} = {
HttpServer.listen(8080) // Start server on port
Console.print("Server listening on port 8080")
let req = HttpServer.accept() // Wait for request
// req is { method: String, path: String, body: String, headers: List<(String, String)> }
Console.print("Got " + req.method + " " + req.path)
HttpServer.respond(200, "Hello, World!") // Send response
HttpServer.stop() // Stop server
}
```
### Time
```lux
fn example(): Unit with {Time, Console} = {
let start = Time.now() // Current timestamp (milliseconds)
Time.sleep(1000) // Sleep for 1 second
let elapsed = Time.now() - start
Console.print("Elapsed: " + toString(elapsed) + "ms")
}
```
### Random
```lux
@@ -292,6 +320,24 @@ fn example(): Int with {Fail} = {
}
```
### Test
Native testing framework:
```lux
fn runTests(): Unit with {Test, Console} = {
Test.assert(1 + 1 == 2, "basic math")
Test.assertEqual(List.length([1,2,3]), 3, "list length")
Test.assertTrue(String.contains("hello", "ell"), "contains check")
Test.assertFalse(List.isEmpty([1]), "non-empty list")
}
// Run with test handler
fn main(): Unit with {Console} = {
run runTests() with { Test = testReporter }
}
```
## Quick Reference
| Module | Key Functions |
@@ -309,9 +355,12 @@ fn example(): Int with {Fail} = {
| File | read, write, exists, list, mkdir, delete |
| Process | exec, env, args, cwd, exit |
| Http | get, post, put, delete |
| HttpServer | listen, accept, respond, stop |
| Time | now, sleep |
| Random | int, float, bool |
| State | get, put |
| Fail | fail |
| Test | assert, assertEqual, assertTrue, assertFalse |
## Next

View File

@@ -31,18 +31,15 @@ Examples: `foo`, `myVar`, `Type`, `Option`
42
-17
1_000_000 // Underscores for readability
0xFF // Hexadecimal
0b1010 // Binary
// Floats
3.14
2.5e10
-1.5e-3
-1.5
// Strings
"hello"
"line1\nline2" // Escape sequences
"value: ${expression}" // String interpolation
"value: {expression}" // String interpolation
"multi
line
string"
@@ -77,10 +74,13 @@ false
| `\n` | Newline |
| `\t` | Tab |
| `\r` | Carriage return |
| `\0` | Null character |
| `\\` | Backslash |
| `\"` | Double quote |
| `\'` | Single quote |
| `\$` | Dollar sign |
| `\{` | Literal brace (in interpolated strings) |
Note: Invalid escape sequences (e.g., `\z`) produce a parse error.
## Declarations

View File

@@ -2,6 +2,50 @@
This guide explains how to write and run tests for Lux programs.
## Native Test Effect
Lux provides a built-in `Test` effect for writing tests:
```lux
fn runTests(): Unit with {Test, Console} = {
// Basic assertions
Test.assert(1 + 1 == 2, "basic math")
// Equality checks
Test.assertEqual(List.length([1, 2, 3]), 3, "list length")
// Boolean assertions
Test.assertTrue(String.contains("hello", "ell"), "contains check")
Test.assertFalse(List.isEmpty([1]), "non-empty list")
}
// Run with the test handler
fn main(): Unit with {Console} = {
run runTests() with { Test = testReporter }
}
let result = run main() with {}
```
### Test Effect Operations
| Operation | Purpose |
|-----------|---------|
| `Test.assert(condition, message)` | Assert condition is true |
| `Test.assertEqual(expected, actual, message)` | Assert values are equal |
| `Test.assertTrue(condition, message)` | Assert condition is true (alias) |
| `Test.assertFalse(condition, message)` | Assert condition is false |
### Running Tests
```bash
# Run a test file
lux tests/my_tests.lux
# Run with the test runner
lux test tests/
```
## Test File Structure
Lux uses a simple test framework based on comparing program output against expected results. Tests are organized in the `tests/` directory.