unison README

The project's README from github.com/unisonweb/unison. As one markdown file: README.md.

The Unison language

CI Status Pre-Release Status

Alt

Overview

Unison is a statically-typed functional language with type inference, an effect system, and advanced tooling. It is based around a big idea of content-addressed code, in which function are identified by a hash of their implementation rather than by name, and code is stored as its AST in a database. This provides a number of benefits:

Unison can be used like any other general-purpose language, or you can use it in conjunction with Unison Cloud for building distributed systems.

Here is some sample code:

-- A comment!
-- Function signatures appear before the definition
factorial : Nat -> Nat
factorial n = product (range 1 (n + 1))

-- Signatures can be left off; they will be inferred
List.map f as =
  go acc rem = match rem with
    [] -> acc
    a +: as -> go (acc :+ f a) as
  go [] as

> List.map (x -> x * 10) (range 0 10)
= [0, 10, 20, 30, 40, 50, 60, 70, 80, 90]

> List.map factorial [1,2,3,4]
= [1, 2, 6, 24]

Functions arguments are separated by spaces instead of parens and commas. Loops are written using recursion (above the helper function go defines a loop). The language supports pattern matching via match <expr> with <cases>, which works for lists and also user-defined data types.

Other resources:

Building using Stack

If these instructions don't work for you or are incomplete, please file an issue.

The build uses Stack. If you don't already have it installed, follow the install instructions for your platform. (Hint: brew update && brew install stack)

$ git clone https://github.com/unisonweb/unison.git
$ cd unison
$ stack --version # we'll want to know this version if you run into trouble
$ stack build --fast --test && stack exec unison

To run the Unison Local UI while building from source, you can use the /dev-ui-install.sh script. It will download the latest release of unison-local-ui and put it in the expected location for the unison executable created by stack build. When you start unison, you'll see a url where Unison Local UI is running.

See development.markdown for a list of build commands you'll likely use during development.

Language Server Protocol (LSP)

View Language Server setup instructions here.

AI Agent Server (MCP)

View AI Agent Server setup instructions here.

Codebase Server

When ucm starts it starts a Codebase web server that is used by the Unison Local UI. It selects a random port and a unique token that must be used when starting the UI to correctly connect to the server.

The port, host and token can all be configured by providing environment variables when starting ucm: UCM_PORT, UCM_HOST, and UCM_TOKEN.

Configuration

See the documentation for configuration here

unison (unisonweb/unison)

Searching Database…

6.8K ·GitHub
Что это?Unison — функциональный язык программирования со статической типизацией, выводом типов, системой эффектов и продвинутыми инструментами, построенный вокруг идеи контентно-адресуемого кода, где функции идентифицируются хешем своей реализации, а не именем.
Unison — полноценный язык программирования или дополнение к существующему проекту?Это полный универсальный язык программирования с собственным компилятором, рантаймом (ucm) и форматом кодовой базы, а не библиотека. Код хранится как AST в базе данных и ссылается по контентному хешу, а не по имени или пути к файлу.
Нужен ли установленный Stack, чтобы собрать его?Да, Stack — инструмент сборки, на котором основан Unison; на macOS его можно установить через Homebrew.
Придётся ли терпеть долгие компиляции, как в других языках?Нет — в Unison идеальная инкрементальная компиляция с общим кешем компиляции, встроенным в формат кодовой базы, так что почти никогда не приходится ждать компиляции, а переименование определений мгновенно и ничего не ломает.
Для чего используется Unison Cloud?Он позволяет взять код Unison, написанный как обычную программу, и запустить его как распределённую систему без смены языка или инструментов.
Почему контентно-адресуемый код избегает конфликтов слияния?Поскольку определения идентифицируются хешем реализации, а не текстом или форматированием, контроль версий Unison понимает семантику и игнорирует такие вещи, как порядок импортов или различия в пробелах, обычно вызывающие ложные конфликты.
Как работает веб-сервер Codebase?При запуске ucm поднимает веб-сервер на случайном порту с уникальным токеном, который Unison Local UI использует для подключения; порт, хост и токен можно переопределить переменными окружения UCMPORT, UCMHOST и UCMTOKEN.
Что происходит с тестами, когда я меняю код?Unison идеально кеширует результаты тестов и перезапускает детерминированные тесты только когда реально меняются их зависимости, избавляя от лишних прогонов.
What are similar projects?morloc, rust-analyzer, epiq, elixir, otp, Benzi, nvim-lspconfig, Nim
Creator
unisonweb
Size
148 MB
Stars
6.8K
Age
11y
Commits · 90 Days