Hraness
Theme
Appearance

saved

Fai: a functional language for humans and AI agents

by Krzysztof CieślakGitHubpublished

Hraness wrote this summary from a saved copy of the source. Quotations are taken word for word from the source.

gist

Fai is a small, strict, pure, statically typed functional language in the ML and F# family, with a native Rust compiler, designed so humans and AI agents can generate, check and test code quickly and reliably. Explicit capabilities and effect rows, inline examples and properties, and structured JSON diagnostics aim to catch mistakes in generated code early.

ideas

  • Effects in the signature. A Koka-inspired row-based effect system makes console, file system, network and clock access explicit capabilities passed from main, so pure functions are visibly pure.
  • Contracts beside code. Type-checked example and forall declarations live next to functions; check evaluates examples and test runs properties with shrinking counterexamples.
  • Tight agent loops. A Salsa-based incremental compiler, a warm per-workspace daemon, stable error codes, and a shared CLI and language-server query engine give agents fast, precise feedback.
  • Native and allocation-light. Cranelift compiles ahead of time or just in time, while Perceus-style reference counting with reuse analysis and sequence fusion avoid a tracing collector.
  • Agent-first docs. A self-contained llms.txt teaches agents to write Fai, alongside packages for JSON, web, SQL, CLI, TUI and LLM clients; it is an early release whose APIs may change.

quotes

“Its type system, explicit effects, and built-in contracts make code easier to reason about and help catch mistakes in generated code.”

Fai README.

“Passing a property test is evidence, not a proof for every possible input.”

Fai README.

“Holding a capability is pure; invoking its methods incurs effects.”

Fai README.

“The aim is a language that is straightforward to generate, quick to iterate on, and practical to run.”

Fai README.