Lake

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"
linemeaning
projectname + version
entrythe file lakec compiles
depa dependency (registry, git+url#ref, or path "…")
envan env var injected into the build
flagan 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:

lake
+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:

lake
+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

  • lakeup manages the toolchain; house manages projects & packages.
  • lake.house declares project / entry / dep / env / flag.
  • house build | run | test | add | publish cover the workflow.
  • deps inject a <NAME>_PATH; the pg package is a pure-Lake PostgreSQL client (v3 + SCRAM-SHA-256).