Kit blends Clojure-style expressiveness with Hindley-Milner type inference, an effect system, and native compilation via Zig. Professional-grade tooling with helpful error messages and a dual-backend architecture (interpreter and compiler) for maximum developer productivity.
$ curl -fsSL https://kit-lang.org/install.sh | bash
module Hello
# Functional programming made simple
double = fn(x) => x * 2
numbers = [1, 2, 3, 4, 5]
# Type-safe transformations
result = map double numbers
# => [2, 4, 6, 8, 10]
# Pattern matching with ADTs
match result
| [x, y | rest] -> x + y
| _ -> 0
Hindley-Milner type inference means you write less code while getting more safety. Types are inferred automatically, catching errors at compile time, with optional linear, affine, relevant, and borrow annotations when ownership matters.
# No type annotations needed
add-five = fn(x) => x + 5
result = map add-five [1, 2, 3]
# => [6, 7, 8]
Track side effects at the type level. Know exactly what your functions doβpure computation, I/O, network calls, or state mutations.
# Effects tracked automatically
pure-fn = fn(x) => x * 2
# Effect: Pure
io-fn = fn(msg) => println msg
# Effect: IO
Compile to optimized native binaries via Zig or run directly with the interpreter. Get the performance of native code with zero runtime dependencies.
# Compile to native binary
$ kit build hello.kit -o hello
$ ./hello
Hello, World!
# Or run with interpreter
$ kit run hello.kit
Algebraic data types with powerful pattern matching including user-defined active patterns. Exhaustiveness checking ensures you handle all cases.
pattern positive = fn(n) =>
if n > 0 then Some n else None
result = match 42
| positive x -> x * 2
| _ -> 0
Built-in actors with lock-free mailboxes, work-stealing scheduler, and Erlang-style supervisors. Distributed actors communicate transparently across nodes.
# Create actor with handler and state
handler = fn(msg, state) =>
match msg
| :inc -> state + 1
| :dec -> state - 1
counter = Actor.new handler 0
counter <- :inc # send message
Built entirely in Zig for fast compilation and small binaries. The compiler generates optimized Zig code that compiles to native executables.
# Two backends, same semantics
$ kit run app.kit # interpreter
$ kit build app.kit -o app # compiler
# Both produce identical output
Hello from Kit!
Complete developer toolchain: project initialization, type checking, test runner, package management, and Rust-quality error messages with "Did you mean?" suggestions.
# Complete tooling suite
$ kit init my-project
$ kit check
$ kit test --coverage
$ kit run src/main.kit
# Error: Unbound variable 'greeet'
# Did you mean 'greet'?
Many built-in collections: Map, Set, Deque, Stack, Queue, Heap, Trie, SkipList, Graph, BloomFilter, Rope, AVL/RB/B-Trees, and more. Immutable by default.
# Rich collection library
h = Heap.from-list [5, 1, 3]
t = Trie.insert "hello" Trie.empty
g = Graph.add-edge "a" "b" Graph.empty
# Priority queue operations
Heap.peek h # 1 (min-heap)
Pandas-style DataFrames powered by Apache Arrow and SIMD-accelerated CSV parsing. Filter, aggregate, sort, and transform tabular data with columnar storage.
# Load and analyze data
df = DataFrame.from-csv "data.csv"
avg = DataFrame.mean "price" df
# Filter and transform
DataFrame.filter (fn(r) => r.age > 21) df
High-performance lock-free channels: SPSC, MPSC, and unbounded variants. Go-style concurrency primitives built into the runtime.
# Create typed channels
ch = Channel.mpsc 100 |> Result.unwrap
# Send/receive with blocking
Channel.send ch "hello"
msg = Channel.recv ch |> Result.unwrap
# Non-blocking variants
Channel.try-send ch "world"
Built-in HTTP client/server, TCP/UDP sockets, WebSockets, SMTP email, Redis client, file system operations, and compression (tar, zip, gzip).
# HTTP client with ease
resp = HTTP.get "https://api.example.com"
|> Result.unwrap
body = resp.body
# WebSocket connections
ws = WebSocket.connect "wss://..."
WebSocket.send ws "hello"
Native support for JSON, CSV (SIMD-accelerated), binary encoding, and Base64. Parse and generate data with zero external dependencies.
# JSON parsing built-in
data = JSON.parse "{\"name\": \"Kit\"}"
name = JSON.get "name" data
# SIMD-accelerated CSV
rows = CSV.parse csv-text
First-class testing with test blocks, assertions, and coverage tracking. Run with
kit test --coverage for comprehensive test reporting and LCOV/JSON coverage reportsβno
external frameworks required.
# Define test blocks
test "addition works" =>
assert-eq! (add 2 3) 5
# Run with coverage
$ kit test --coverage
Coverage: 45/52 lines (86.5%)
Preconditions and postconditions with @pre and @post. Plus refinement
types like {x: Int | x > 0} for type-level constraints.
# Contracts on functions
@pre(n >= 0, "n must be non-negative")
factorial = fn(n) =>
if n <= 1 then 1
else n * factorial(n - 1)
# Refinement types
type PositiveInt = {x: Int | x > 0}
CPU timestamp counters, statistical benchmarking, branchless binary search, SIMD operations, and zero-copy I/O for performance-critical applications.
# Cycle-accurate timing
start = Time.rdtsc()
# ... your code ...
cycles = Time.rdtsc() - start
# Statistical benchmarking
stats = Bench.run "op" 100 10000 thunk
Compile Kit programs to WASM for browser deployment, serverless/edge computing, and cross-platform distribution. Works with WASI runtimes like Wasmtime, Wasmer, and Node.js.
# Compile to WebAssembly
$ kit build app.kit --target wasm
# Run with Node.js WASI
$ node --experimental-wasi app.wasm
# Pure computation works perfectly
# Basic I/O via WASI
Concise pattern matching with is, as, and guard keywords.
Check patterns, extract values with defaults, and enable early returns without verbose match blocks.
# Pattern check (returns bool)
if status is Passed then "ok" else "fail"
# Extract with default
name = user as Some u -> u.name else "Anonymous"
# Early return on mismatch
guard Ok data = fetch() else Err "failed"
Use .field as shorthand for fn(x) => x.field. Perfect for pipelines and
higher-order functions like map and filter.
# Shorthand accessor
get-name = .name
println (get-name {name: "Kit"}) # Kit
# In pipelines
users = [{name: "Alice"}, {name: "Bob"}]
names = users |>> List.map (.name)
# => ["Alice", "Bob"]
User-defined macros with quasiquotation syntax. Create DSLs, generate code, and transform AST at compile time while preserving type safety.
# Define a macro
macro unless cond then-val else-val =
`(if (not $cond) then $then-val else $else-val)
# Use the macro
result = unless((1 == 2), 42, 0) # => 42
# Arithmetic macros
macro double x = `($x + $x)
Pony-inspired runtime capability restrictions plus explicit authority tokens. Control what
programs can access with --allow, --deny, and --sandbox,
then derive least-authority tokens from env.root. Direct authority constructors are
rejected outside test blocks, including imported package code.
# Allow only file access
$ kit run --allow=file app.kit
# Deny network, allow everything else
$ kit run --deny=net app.kit
# Pure sandbox (no I/O)
$ kit run --sandbox app.kit
Opt-in open records with ... syntax. Write functions that accept records with extra
fields while still requiring specific fields. Closed records remain the default.
# Open record accepts extra fields
greet = fn(p: {name: String, ...}) =>
"Hello, " ++ p.name
greet({name: "Kit"}) # OK
greet({name: "Kit", age: 1}) # OK
# {...} accepts any record
accept-any = fn(r: {...}) => "got it"
Kit provides a complete, Gleam-inspired toolchain with everything you need for professional development. No third-party tools requiredβit's all built-in.
kit initInitialize new Kit projects with a kit.toml manifest. Sets up package metadata, dependencies, and project structure.
$ kit init my-project
kit test
Run tests defined in your Kit files. Supports assertions, test blocks, coverage tracking, and
comprehensive test reporting. Use --coverage to generate LCOV or JSON coverage reports.
Use kit-quickcheck
for property-based testing.
$ kit test --coverage src/tests.kit
kit devConvention-based development workflow. Automatically runs format, check, and test based on your project structure. Customizable via kit.toml tasks.
$ kit dev
kit check
Type check your Kit files without running them. By default, kit check recursively
discovers .kit files in the current directory, or you can pass files explicitly.
$ kit check
kit build --info
Build native, WASM, or WASI artifacts with detailed timing, typecheck, cache, backend,
and final artifact diagnostics. Use --info-layout for terminal-friendly output.
$ kit build --info app.kit
kit parityRun interpreter/compiler parity checks for Kit sources. Useful for example suites, regressions, and validating that interpreted and compiled behavior stay aligned.
$ kit parity examples/ --failures-only
kit format
Format Kit source files with consistent style. Also formats Kit code blocks in Markdown files.
Supports --check for CI validation and configurable indent width.
$ kit format src/*.kit README.md
kit installInstall dependencies from kit.toml, including transitive package requirements. Supports Git repositories, local paths, and versioned packages.
$ kit install
kit cacheManage the package cache. View statistics, list cached packages, or clear the cache for fresh installs.
$ kit cache list
kit lspFull Language Server Protocol support for VS Code, Zed, Neovim, Helix, and Emacs. Get autocomplete, hover info, go-to-definition, find references, parser recovery, quick fixes, and real-time diagnostics.
$ kit lsp
Helpful error messages with "Did you mean?" suggestions using edit-distance analysis. Context-aware type errors explain exactly what went wrong.
Error: Unbound variable 'greeet'
Did you mean 'greet'?
Kit combines a broad standard library with a first-party package collection maintained by the Kit team. Start with documented, versioned integrations for modern development before reaching for third-party packages.
Standard-library modules and first-party packages are documented together. Use Kit.* imports
for first-party packages; FFI-backed packages list native setup requirements on their package pages.
# Functional programming essentials
# First-class functions
square = fn(x) => x * x
add-one = fn(x) => x + 1
# Function composition
numbers = [1, 2, 3, 4, 5]
doubled = map (fn(x) => x * 2) numbers
# => [2, 4, 6, 8, 10]
evens = filter (fn(x) => x % 2 == 0) numbers
# => [2, 4]
sum = fold (fn(acc, x) => acc + x) 0 numbers
# => 15
Kit makes functional programming natural and intuitive. Higher-order functions like
map, filter, and reduce are built-in and optimized.
# Define custom algebraic data types
type Result a b =
| Ok a
| Error b
# Safe division with error handling
safe-div = fn(x, y) =>
match y
| 0 -> Error "Division by zero"
| _ -> Ok (x / y)
# Pattern match on results
result = safe-div 10 2
match result
| Ok value -> println value
| Error msg -> eprintln msg
Define custom types with multiple constructors. Pattern matching ensures exhaustive handling of all cases at compile time.
option, result)# Data processing pipeline
data = [
{name: "Alice", age: 30, score: 95},
{name: "Bob", age: 25, score: 87},
{name: "Carol", age: 35, score: 92}
]
# Filter and transform in one pipeline
top-performers =
data
|> filter (fn(p) => p.score > 90)
|> map (fn(p) => p.name)
|> String.join ", "
# => "Alice, Carol"
# Complex aggregations
avg-score =
data
|> map (fn(p) => p.score)
|> fold (fn(a, x) => a + x) 0
|> fn(total) => total / (List.length data)
Chain operations elegantly with pipeline operators. Transform, filter, and aggregate data with clear, readable code.
|># Actor-based concurrency
# Create actor with handler and state
handler = fn(msg, state) =>
match msg
| :inc -> state + 1
| :dec -> state - 1
counter = Actor.new handler 0
# Send messages to actor
counter <- :inc
counter <- :inc
println (Actor.state counter) # => 2
Built-in support for concurrent actors, parallel processing, and channels. Fault-tolerant by design with supervision strategies.
Explore more examples in the kit-examples repository.
# hello.kit
module Hello
println "Hello, Kit!"
double = fn(x) => x * 2
result = map double [1, 2, 3]
println result
# Run with interpreter
kit run hello.kit
# Or compile to native binary
kit build hello.kit -o hello
./hello
Supported platforms: macOS and Linux
Current version: 2026.6.4
Complete reference for Kit's syntax, semantics, and type system
Step-by-step tutorial for new users to learn Kit
Complete reference for all built-in functions with examples
Get Kit installed and learn the command-line tools for building and running projects
Explore first-party Kit packages for databases, web, graphics, and more
Real-world code examples and patterns
Designer & human-in-the-loop
Co-designers & Implementers
ChatGPT -> Claude Code -> Gemini -> Codex -> Claude Code -> Kimi K2.5 -> Codex -> Kimi K2.6