Introduction
Unison is a functional programming language that takes a fundamentally different approach to code management. Instead of storing code as text files, Unison identifies every definition by the hash of its syntax tree. This means renaming a function does not break dependents, dependency conflicts cannot exist, and code can be trivially shared or executed across distributed nodes.
What Unison Does
- Stores code in a content-addressed codebase where definitions are identified by hash, not name
- Eliminates dependency hell because two versions of the same library can coexist without conflict
- Provides built-in support for distributed computing via its Abilities system (algebraic effects)
- Includes the Unison Codebase Manager (UCM) for browsing, editing, and sharing code
- Supports structural typing and pattern matching with a Haskell-inspired syntax
Architecture Overview
The Unison Codebase Manager (UCM) is the central development tool. When you write Unison code in a scratch file, UCM watches for changes, typechecks the definitions, and stores them in a local SQLite-backed codebase keyed by content hash. Names are metadata attached to hashes, not identifiers. The runtime compiles Unison to an intermediate representation that runs on a custom virtual machine. The Abilities system (similar to algebraic effects) allows pure expression of side effects that can be interpreted differently in tests vs. production.
Self-Hosting & Configuration
- Download the UCM binary from the official releases for Linux, macOS, or Windows
- The codebase is stored locally in
~/.unisonby default - Pull libraries from Unison Share (share.unison-lang.org), the community package hub
- Use
ucmcommands to create namespaces, push/pull code, and run tests - Scratch files (
.uextension) are watched by UCM and typechecked on save
Key Features
- Content-addressed storage makes all refactors (renames, moves) perfectly safe
- Abilities system provides typed, composable effect handling without monads
- Built-in test framework with
test>watch expressions that run on save - Distributed computing primitives let you describe computations that span multiple nodes
- Unison Share enables publishing and discovering libraries with no version conflicts
Comparison with Similar Tools
- Haskell — similar syntax and type system, but Haskell uses traditional file-based modules; Unison's hash-based storage eliminates breakage from renames
- Erlang/Elixir — strong in distribution; Unison adds content-addressing and a typed effect system
- Scala — JVM functional language; Unison has a lighter runtime and novel codebase model
- Darcs — a VCS with patch theory; Unison applies similar ideas at the code-definition level rather than file level
FAQ
Q: Where is the source code stored if not in files?
A: Definitions live in a content-addressed SQLite codebase. You write in scratch .u files, but UCM parses them and stores the hashed AST. Names are just metadata pointers to hashes.
Q: Can I use Unison for production applications? A: Unison is maturing but still evolving. It is best suited for exploratory projects, distributed computing experiments, and developers interested in next-generation language design.
Q: How do I share Unison code with others?
A: Push your namespace to Unison Share with push in UCM. Others pull it into their codebase. Since code is content-addressed, there are no version conflicts.
Q: Does Unison have an IDE? A: UCM is the primary interface. Editor plugins for VS Code provide syntax highlighting. The language server protocol (LSP) support is in development.