Unison


A new approach to

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

$
$

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 thestew.http library.

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

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

Learn More