Packages & tooling
A Lake project is driven by house, the build tool and package
manager, and the toolchain itself is managed by lakeup (see
installation).
§Projects and the manifest
house new <name> scaffolds a project. Its manifest is lake.house:
project "myapp" "0.1.0"
entry "src/main.lake"
dep "pg" "0.1.0"
env "DATABASE_URL" "postgres://localhost/dev"
flag "--release"
| line | meaning |
|---|---|
project | name + version |
entry | the file lakec compiles |
dep | a dependency (registry, git+url#ref, or path "…") |
env | an env var injected into the build |
flag | an extra flag passed to lakec |
§Commands
house build # resolve deps + compile entry with lakec
house run # build + execute the binary
house test # build + run tests/main.lake (exit 0 = pass)
house add pg 0.1.0 # add and pin a registry dependency
house publish # publish the current package to the registry
§Dependencies and the registry
A dep is resolved and its source root injected as <NAME>_PATH, so
imports use the dependency name:
+pg.{ connect query } # from dep "pg"house publish registers a package in the Lake registry; house add
pulls one back down. Local development can pin a checkout with
path "…".
§The pg package — PostgreSQL in pure Lake
pg is a PostgreSQL client implemented entirely in Lake over TCP — no
C, no libpq. It speaks the v3 wire protocol, authenticates with
SCRAM-SHA-256 (using the crypto primitives), and
supports simple and prepared queries:
+pg.{ connect query close ip_v4 }
let c = connect(ip_v4(127 0 0 1) 5432 user db password)
let rows = query(c "SELECT 1::int4")
close(c)§A real application
These pieces combine into a complete, native, DB-backed web service —
a URL shortener — written in Lake: an actor accepts each connection,
the request is parsed and routed, links are stored in PostgreSQL via
pg, and HTML is rendered by a small page-builder. It builds with
house and runs as a single ~1.5 MB binary, with no virtual machine
and no garbage collector. The same stack powers
shortener.lake-lang.com.
§Key ideas
lakeupmanages the toolchain;housemanages projects & packages.lake.housedeclaresproject/entry/dep/env/flag.house build | run | test | add | publishcover the workflow.deps inject a<NAME>_PATH; thepgpackage is a pure-Lake PostgreSQL client (v3 + SCRAM-SHA-256).