Unison - programming redefined

Unison is a modern, purely functional programming language with a unique approach to code organization, reuse, and distributed computing. Here’s a concise summary of its key features and what sets it apart from other functional languages:


Core Philosophy

Unison is designed to be content-addressable, meaning code is identified by its content (what it does) rather than its location (where it’s stored). This enables powerful features like automatic dependency management, versioning, and seamless code sharing.


Distinctive Features

1. Content-Addressable Code

  • Every function, type, and data structure is identified by a hash of its definition, not by a filename or path.
  • This eliminates dependency conflicts and makes code reuse trivial - just reference the hash.

2. Immutable, Purely Functional

  • Like Haskell, Unison enforces purity and immutability, but with a stronger focus on referential transparency and deterministic behavior.

3. No Build System

  • Unison has no traditional build system or package manager. Instead, code is self-contained and automatically versioned.
  • Dependencies are resolved by content, not by name or version number.

4. Unified Language for Code and Data

  • Unison treats code and data uniformly. Functions, types, and even tests are all stored in the same content-addressable namespace.
  • This allows for seamless refactoring—renaming or moving code doesn’t break dependencies.

5. Built-in Distributed Computing

  • Unison is designed for distributed execution from the ground up.
  • The same code can run locally or on a cluster, with built-in support for remote execution and fault tolerance.

6. Type System

  • Algebraic effects and handlers are first-class citizens, enabling clean, composable side effects (e.g., logging, concurrency, I/O).
  • Supports higher-kinded types and row polymorphism, making it highly expressive.

7. Interactive Development

  • Watch mode automatically re-evaluates code as you edit it, providing instant feedback.

8. No Boilerplate

  • Unison eliminates much of the boilerplate found in other languages (e.g., no need for main functions, explicit imports, or build configurations).

9. Pattern Matching and Data Types

  • Supports pattern matching and algebraic data types (ADTs) similar to Haskell or ML, but with a more concise syntax.

10. Unison Share

  • A public code repository where users can publish and discover reusable components by hash, not by package name.

Example: Hello World

hello : '{IO, Exception} ()
hello = printLine "Hello, World!"
  • The type signature {IO, Exception} () indicates that the function performs I/O and may throw exceptions.

Current Status

Unison is open-source and actively developed. While still evolving, it’s gaining traction for its radical approach to code organization and distributed computing.