Unison


A new approach to

Unison is a friendly programming language from the future: statically-typed, functional, and a lot of fun 😄

$
On Apple Silicon? You'll need Rosetta to run Unison.
$

How does Unison code look?

💡 All parts of the code examples are interactive. Click a dependency to read its definition and docs.

👋 Hello World

The classic Hello World program in Unison is as simple as a call to printLine.

helloWorld : '{IO, Exception} ()
helloWorld _ = printLine "Hello World"

{IO, Exception}indicates which abilities the program needs to do I/O and throw exceptions.

'
is used to denote a delayed computation.

Learn more about Abilities.

Distributed map-reduce

With a few lines of code, you can perform a distributed map-reduce using theRemoteability.

distributedEx : Seq k Nat ->{Remote} Nat
distributedEx dseq =
  dseq
    |> Seq.map (x -> x + 1)
    |> Seq.filter (x -> mod x 7 == 0)
    |> Seq.reduce 0 (+)

Learn more about Remote and working withdistributed datasets in Unison.

HTTP request

Perform effectful code, like HTTP requests withAbilitiesandAbility handlers.

Checkout more HTTP examples in thehttp library.

httpEx : '{IO, Exception} Response
httpEx _ =
  host = HostName "unison-lang.org"
  web = Authority None host None
path = Path.root / "docs"
  uri = Uri https (Some web) path Query.empty None
  req = Request.get uri
  handle request req with Http.handler

What's it like to write Unison code?

The Unison Codebase Manager (UCM) is by your side as you write, guiding you through the
development process; adding, updating, and running your programs.

Editor : ~/scratch.u
Terminal : UCM - Unison Codebase Manager
👋 Welcome to Unison!

.> 

              

Unison at a glance: get a complete overview of Unison with many more examples.

Learn More