Unison is a new programming language, currently under active development. It’s a modern, statically-typed purely functional language, similar to Haskell, but with a unique ability to describe entire distributed systems with a single program. Here’s a simple example:
-- comments start with `--` -- alice : Node, bob : Node x = factorial 6 Remote.at alice '( y = foo x -- happens on `alice` node Remote.at bob '( bar x y )) -- happens on `bob` node
Remote.at function introduces a “remote effect”, where computation may proceed on multiple Unison nodes:
Remote.at alicetransfers control of the computation to the
foo xcall happens on the
x) will be dynamically deployed to the
alicenode and cached for future use.
Remote.at bobtransfers control of the rest of the computation to the
bar x ycomputation happens on the
bobnode. Again, any needed definitions (
y) will be dynamically deployed to the
This dynamic transfer / deployment of arbitrary computations is possible because definitions in Unison are identified by a cryptographic hash of their content, including the hashes of all dependencies (the hash is also “nameless” as it isn’t affected by naming of variables). To transfer a computation, we send it to the recipient, and the recipient checks to see if the computation references any unknown hashes. Any unknown hashes are synced to the recipient before the transfer completes and the computation proceeds.
If you’d like to learn more about the project, the talk How to write a search engine in 15 lines of code has more of an introduction to the language.