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:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user