Skip to content
Halyard
Project
Source code on Codeberg (opens in new tab)

Search

Menu

The Data Language That Compiles to Confidence

Build fast. Ship confidently. Compile-time data contracts, automatic lineage, strong types, and column safety — because finding bugs in production isn't a feature.

This example does not compile. Press Run: the column is misspelled, and halyard reads the Parquet file's schema while compiling — so the mistake is a build error, not a 3 a.m. pager.

halyard
import DataFrame

-- The annotation is the contract: halyard reads the file's schema while
-- compiling and checks these names and types against it.
let customers : DataFrame { customer_id : Int, name : String, lifetime_valu : Int, .. } =
    (DataFrame.readParquet "data/customers.parquet")?

DataFrame.count customers

What Makes Halyard Different

Data Contracts at Compile Time

CSV, Parquet, JSON and Stata schemas validated when you compile, not when you run. Data contracts enforced by the type system, not by documentation.

Compile-Time Column Safety

Reference a column that doesn't exist and the compiler refuses the build, listing the columns the file actually has — before deployment, not in production.

Automatic Data Lineage

Every transformation tracked automatically. Full data provenance from source to result without writing extra code or using external tools.

Strong Typing

Halyard's type system extends to your data. Column types, nullability, and schema shapes are tracked statically — mismatches are compiler errors, not runtime surprises.

Functional Style

Build pipelines from composable, pure transformations. Chain operations that are easy to reason about, test in isolation, and refactor without fear.

Speed

Compiled to bytecode by a register-based compiler. Faster than Python without the complexity of native toolchains.

Code Examples

Pipeline

halyard
import DataFrame
import DataFrame.Expr exposing col
import Result

-- `..` fixes the columns this pipeline needs and lets the file carry the rest.
let sales : DataFrame { transaction_id : Int, amount : Int, .. } =
    (DataFrame.readParquet "data/sales.parquet")?

-- Expressions are values; `0.08d` is a Decimal, so the money stays exact.
let taxExpr = col @amount * 0.08d

let totalExpr = col @amount + col @tax

-- Each step hands its Result on, so a failed step is Err, not empty data.
sales
    |> DataFrame.applyExprs [(@tax, taxExpr)]
    |> Result.andThen (DataFrame.applyExprs [(@total, totalExpr)])
    |> Result.andThen (DataFrame.column @total)

Lineage

halyard
import DataFrame
import DataFrame.Expr exposing col
import List
import Maybe
import Result

let transactions : DataFrame { merchant_id : Int, amount : Int, .. } =
    (DataFrame.readParquet "data/transactions.parquet")?

-- Lineage is recorded as the pipeline runs: no instrumentation, no extra code.
transactions
    |> DataFrame.applyExprs [(@fee, col @amount * 0.02)]
    |> Result.andThen (DataFrame.select [@merchant_id, @fee])
    |> Result.map (DataFrame.columnLineage @fee)
    |> Result.map (Maybe.map (|l| l.transformations |> List.map (|t| t.operation)))

Aggregate

halyard
import DataFrame
import DataFrame.Expr as Expr
import Result

let transactions : DataFrame { category : String, amount : Int, .. } =
    (DataFrame.readParquet "data/transactions.parquet")?

-- Group, sum, and ask for one category: Exprs are the same values throughout.
transactions
    |> DataFrame.groupBy [@category]
    |> DataFrame.agg [@amount |> Expr.sum |> Expr.named "total"]
    |> DataFrame.filter (@category |> Expr.eq "groceries")
    |> Result.andThen (DataFrame.column @total)

Join Cardinality

halyard
import DataFrame
import Result

let logins : DataFrame { name : String, day : String, .. } =
    (DataFrame.readCsv "data/logins.csv")?

let users : DataFrame { name : String, status : String, .. } =
    (DataFrame.readCsv "data/users_status.csv")?

-- OneToOne is a claim about the data, and it is enforced: Ana logged in three
-- times, so this answers Err instead of quietly returning a longer table.
DataFrame.join [@name] [@name] JoinType::OneToOne logins users
    |> Result.map DataFrame.count

Runtime Contract

halyard
import DataFrame
import Result

-- No annotation on this read, so nothing was checked while compiling.
-- checkSchema applies the same contract to data as it arrives.
type alias Inbound = { customer_id : Int, lifetime_value : Int, .. }

let inbound = (DataFrame.readParquet "data/customers.parquet")?

inbound
    |> DataFrame.checkSchema Inbound
    |> Result.map DataFrame.count

Browse every example →

Who Uses Halyard

Built for teams that need data contracts, lineage, and provenance they can show.

By Role

Data Engineers

Build data pipelines with data contracts enforced at compile time. Schema changes detected immediately, not in production.

Data Governance Teams

Enforce data quality with compile-time validation. Data contracts prevent schema drift and ensure downstream reliability.

Data Scientists

Spend less time debugging schema mismatches and more time on analysis. Strong types and compile-time column safety catch mistakes before they reach your results.

Academics & Researchers

Automatic lineage gives you built-in provenance for every transformation. Reproducible pipelines that document themselves — no extra tooling required.

By Industry

Financial Services

Transaction and risk pipelines whose inputs are checked against the source file before the run, and whose every column carries the operations that produced it. Decimal money is exact, not floating point.

Healthcare & Life Sciences

Where a value came from is a question the pipeline answers rather than a document you maintain: each column's provenance is recorded as the transformation happens.

Insurance

Actuarial models and claims pipelines where a data error is expensive. Contracts are checked before the run, and lineage shows which inputs reached which result.

Research Institutes

Reproducible pipelines whose provenance is recorded as they run — no separate lineage tool to install, configure and keep in step with the code.

Data Contracts: Compile Time vs Runtime

Halyard validates data contracts at compile time, catching issues before deployment rather than in production.

Halyard compared with Python/Pandas, dbt and Great Expectations
FeatureHalyardPython/PandasdbtGreat Expectations
Data ContractsCompile-time (enforced by compiler)Runtime (manual checks)Test-time (separate layer)Runtime (validation library)
Schema ValidationAutomatic at compileManual (try/except)YAML definitions + testsPython schemas + validation
Column SafetyType-checked before runKeyError at runtimeSQL compilationRuntime assertions
Data LineageBuilt-in automaticManual trackingMetadata in dbt docsSeparate expectation history
When Errors FoundBefore deploymentIn productionCI/CD pipelineIn production
Performance5-7x pandas on I/O and parsing, unoptimisedBaselineSQL engine dependentPython runtime

Installation

Pre-built Binaries

bash
# Download the latest release for your platform:
# https://codeberg.org/halyard/halyard-cli/releases

Nix Flakes

bash
# Run directly without installing
nix run git+https://codeberg.org/halyard/halyard-cli

# Or build the package
nix build git+https://codeberg.org/halyard/halyard-cli

# Enter a development shell
nix develop git+https://codeberg.org/halyard/halyard-cli

From Source

bash
# Clone the repository
git clone https://codeberg.org/halyard/halyard-cli.git
cd halyard-cli

# Build and install
cargo install --path .

Flake Input

nix
{
  inputs.halyard.url = "git+https://codeberg.org/halyard/halyard-cli";
}

Prerequisites: Rust 1.85+ and Cargo (for building from source) or Nix with flakes enabled (for Nix installation)

Roadmap

What's shipped, what's next, and what's on the horizon.

Core Language

In development

Lexer, parser, type inference (HM-style), pattern matching, traits, algebraic effects, opaque newtypes, REPL, LSP, tree-sitter grammar — all working, all pre-1.0

DataFrame & Matrix Library

Available

Polars-backed columnar data with compile-time schema validation, window functions, and a first-class Matrix type

Time-Machine Debugger

Available

Step forward and backward through execution with full environment snapshots via halyard trace

Execution Kernel & Server

Available

Stateless HTTP/WebSocket execution service for the playground and remote runs

Audit Trail

Planned

Machine-readable run manifests recording inputs, outputs, SHA-256 hashes, and status — for regulated workflows (FDA, SOX, SR 11-7)

Traits (Type Classes)

Available

User-definable polymorphic interfaces: one name resolving per type, replacing the old catch-all `comparable` type variable

Algebraic Effects

Available

A function's type says which effects it may perform, and delimited handlers decide what they do — no monads, no async/await

DuckDB Connector

Planned

Load DataFrames from DuckDB files and execute SQL queries with compile-time schema inference

Parallel Execution

Planned

Automatic parallel scheduling of independent let-bindings via compile-time wave graph and Rayon

WASM Extension System

Planned

Third-party Rust crates compiled to WASM and loaded as first-class halyard modules with full type checking and LSP support

Python & R Interop

Planned

Call Python and R libraries from halyard with automatic type bridging — use pandas, scikit-learn, ggplot2, and other ecosystem packages directly

GPU Acceleration

Planned

Transparent GPU dispatch for DataFrame and Matrix operations via wgpu, with CPU fallback

View the full roadmap →

Frequently Asked Questions

Is Halyard ready for production use?

Halyard is currently in active development. The core language works well for data pipelines and analysis, but the ecosystem is still growing. It's great for experimentation and projects where type safety matters, but we recommend waiting for 1.0 for mission-critical production workloads.

How does Halyard help with data quality?

Halyard catches data errors at compile time. The type system validates column types, function signatures, and data flow before your pipeline runs. Pattern matching forces you to handle missing values (Maybe) and errors (Result) explicitly — no silent nulls or unhandled exceptions. DataFrame operations are type-checked against Polars, so schema mismatches are caught early.

How does Halyard compare to Python for data science?

Halyard catches errors at compile time that Python only finds at runtime. The type system ensures column names, data types, and function signatures are correct before your pipeline runs. The Polars-backed DataFrame library provides native-speed operations. However, Python's ecosystem is vastly larger.

What's the performance like?

Halyard compiles to bytecode on a register-based VM. For data-intensive workloads, the Polars-backed DataFrame library provides native-speed operations with SIMD and parallel execution for query plans. General Halyard code runs on the VM with garbage collection optimised for functional patterns.

What data types does Halyard support?

Beyond standard types (Int, Float, String, Bool, List, Record, Tuple), Halyard has first-class Date, Time, DateTime, Duration, and Decimal (28-digit precision) types. The DataFrame library supports Polars-backed tabular data with CSV/JSON/Parquet I/O. Distribution, Table, and ValueLabelSet modules cover statistical workflows.

How do I contribute?

Check out our Codeberg repository! We welcome contributions of all kinds: code, documentation, examples, and bug reports. See the Contributing Guide in the docs for setup instructions.