Three-minute quickstart guide
This short guide will have you downloading and installing Unison and running your first program. There isn't much exposition here and the focus is on getting you up and running as quickly as possible. 🏎
More in-depth guides follow this one.
If you have any trouble with the process, or have ideas about how to improve this document, come talk to us in the #alphatesting Slack channel! This document is also on GitHub.
Step 1: Install Unison
If you haven't already, please join the #alphatesting channel on Slack. Once you're logged in, this Slack post gives the (very brief and simple) install instructions.
When Unison is further along and ready for more general availability we'll just include those instructions here. For now, given the many rough edges that exist, we are really hoping that if you are trying out Unison you'll come talk to us, ask questions, and report bugs!
Step 2: Create your Unison codebase
Run ucm init
to initialize a Unison codebase in $HOME/.unison
. This is where Unison will store function definitions, types, namespaces, and so on.
Step 3: Fetch the base libraries and run your first program
Launch ucm
again, then from the .>
prompt, do:
pull https://github.com/unisonweb/base:.releases._latest base
You'll see some output from git
in the background, and once that's done you'll see a big list of definitions that the pull
added. Press q
to exit the list of definitions.
Make a directory to work in, and create a new file there called scratch.u
with the following contents:
> List.map (x -> x * 10) [1,2,3,4,5,6]
A line beginning with >
is a watch expression, and this one multiplies every element in a list by 10
, using the List.map
function.
If ucm
is not running launch it again in the folder you created. ucm
monitors all the unison source files in the current directory for changes and evaluates any watch expressions:
.>
✅
~/ucm1/scratch.u changed.
Now evaluating any watch expressions (lines starting with `>`)... Ctrl+C cancels.
1 | > List.map (x -> x * 10) [1,2,3,4,5,6]
⧩
[10, 20, 30, 40, 50, 60]
Congratulations, you ran your first Unison program!
What next?
- Come say hello in Slack, tell us what you thought about this guide, and ask questions. 👋
- A more leisurely tour of the Unison language and the
ucm
command line tool. (25 minutes) - A document for setting up your favorite editor with Unison.