Sakura Lang

Prior art

What Sakura Lang takes from Koka, Effect-TS, Rust, Lean, Dafny, Elm, Gleam and others, what it rejects, and why.

Sakura Lang invents very little. Most of the design is borrowed from languages and systems that already proved an idea works. The new part is the combination, and the decision to make all of it the default for code an agent writes.

This page summarizes docs/prior-art.md, which gives, for every entry, what Sakura Lang takes, what it rejects, why, and links to primary sources. The design itself is docs/design.md.

The short version

  • Effects and handlers come from Koka, Effect-TS and Unison: inferred effect rows, effect-polymorphic map, handlers as plain values, tests that swap handlers instead of mocking. Sakura Lang ships only tail-resumptive handlers (no resume), as Koka's fun operations, and keeps rows as sets of unique labels.
  • Typed errors come from Rust, Zig, Swift and ZIO: errors as data with payloads, error sets that grow by union, Never as the bottom, and a hard line between expected failures (Fail<E>) and defects.
  • Memory comes from Lean 4, Koka's Perceus, Swift and Hylo: value semantics, compile-time reference counting, and in-place reuse of unshared buffers. Rust's guarantees without Rust's lifetimes is a design bet, not a measured result.
  • Contracts come from Dafny, Eiffel, Racket and the refinement-type family (F*, Liquid Haskell, Flux): requires/ensures in the signature, blame on the caller or the callee, named refinements, and checks that are never switched off in release.
  • Authority comes from Austral, Pony, Roc, Deno and LavaMoat: no ambient authority, root capabilities handed to main by the host, deny-by-default permissions, and authority graphs a person can review.
  • Agent tooling comes from Elm, Haskell, Hazel, Go and Gleam: typed holes as a normal editing state, diagnostics with expected and actual types and fixes, one formatter with no options, and one compiler-owned CLI.

What Sakura Lang leaves out

Several popular features are rejected on purpose, each because it is a common source of silent bugs or of code that is hard to review:

  • null, exceptions, any and implicit conversions (TypeScript, Python, Go).
  • User-visible lifetimes and borrows (Rust), and manual free (Zig).
  • Laziness, type classes and monad transformers (Haskell).
  • Multi-shot handlers, effect masking and first-class continuations (Koka, Eff, Frank).
  • async coloring (TypeScript, Kotlin, Swift). Every Sakura Lang function may suspend.
  • Macros, operator overloading, inheritance and significant indentation.
  • A codebase database instead of files and Git (Unison).

Summary table

Language / systemSakura Lang takesSakura Lang rejects
Kokainferred effect rows, effect-polymorphic HOFs, tail-resumptive ops, Perceus, dot-callduplicate-label rows, ctl/multi-shot, masking
Effect-TStyped errors + requirements, layers, schedules, schema, fibers, test clockswrapper type, generators, combinator sprawl
Unisonabilities with plain handlers, content-hashed artifacts, compiler MCPimplicit ability variables, codebase database
OCaml 5one-shot continuations for native runtimeunchecked effects
Flixpurity requirements, subeffecting precedentBoolean effect formulas
Eff / Frank / Linksop/handler split, auto effect polymorphism, row theory, CPS referencemulti-shot, instances, multihandlers, wild
EffektCore → CPS → JS pipeline with trampolinecapability-passing surface types
effectful / Polysemy / Bluefinfast service dispatch, test interpreters, scoped capability valuestype-level machinery, manual capability threading
ZIOfailures vs defects vs interruption, concurrent causesNothing as termination proof
Swifttyped throws, Never, value semantics + COW, ownership modifiers (internal)any Error, classes, retain cycles
RustResult/?, exhaustiveness, affine resources, performance baseline, workspace modellifetimes, borrows, traits, macros, unwrap culture
Ziginferred error sets, explicit costs, no build scriptsmanual free, payload-less errors
Gleamsmall language, no null/exceptions, pub opaque type, compiler CLI, readable JSuse sugar
Rocplatform authority, in-place mutation behind values, compact stringsno effect polymorphism
Lean 4borrowed/owned conventions, reset/reuse, uniqueness diagnostics; optional proofsdependent types everywhere
Hylomutable value semanticsinout projections
Valegenerational IDs for graphstraps as lifetime strategy
LobsterRC elision by inferred borrowsacceptance tied to optimization
Mojoinferred lifetimes, explicit transfer for resourceslifetime checker, ^, Python superset
Australlinear capabilities, root capability to mainlinear collections
Ponyobject vs reference capabilities, share-immutable/transfer-isolatedcapability lattice in syntax, actor GC
Goone toolchain, fmt without options, MVS, cost modelnil, ignorable errors, shared mutation
Dafny / Verusrequires/ensures in signatures, modular proofs, frozen specs for agentsmandatory invariants/frames in v0
F* / Liquid Haskell / Fluxnamed refinement types, aliasing factored out of logicstring predicates, dependent effects
Eiffel / Racketcontracts with blamedisable-in-release
QuickCheck / Hypothesis / TARGETproperties, shrinking, refinement-derived generatorsfilter-only generation
FoundationDB / TigerBeetledeterministic simulation via swapped handlersexhaustiveness claims
ElmOption/Result, humane diagnostics, computed semver, MVUbrowser-only scope
Haskelltyped holes, purity default, HM + signatureslaziness, type classes, transformers
OCamlHM with levels, value restriction, match compilationobjects, functors, structural subtyping
TypeScriptfamiliar syntax, discriminated unions, type-aware decoding evidence, ESM outputany, null, exceptions, async coloring
Pythonreadability, batteries, structured-output librariesdynamic typing, indentation syntax
Elixir / Erlangsupervision shape, config split, integrated toolingdynamic typing, BEAM-only semantics
Kotlinstructured concurrency, newline rulesuspend coloring, nullable absence, extensions
MoonBitdefinition-sized edits, fast checks, doc testsunmeasured token claims
BAMLtyped LLM functions, prompt preview, partial types, output checksseparate DSL, silent coercion
Deno / Bun / LavaMoatdeny-by-default grants, single distribution, lockfiles, authority graphsprocess-wide-only permissions
Hazelholes as normal state, hole context for agentsstructure editing only
Vera / Magpie / Mog / AILANGassurance statuses, MCP tooling, no ambient authority, compiler-emitted promptSSA surface, provider syntax, self-reported benchmarks

Read more

  • docs/prior-art.md: the full entry for each language, with sources.
  • Why Sakura Lang: the problem these borrowings are meant to solve.
  • FAQ: short answers to common comparisons.
Edit on GitHub

On this page