Unison

a new distributed programming language

video of this talk

Paul Chiusano Β· @pchiusano

Unison Computing Β· a public benefit corp

Joint work with: Arya Irani, RΓΊnar Bjarnason, awesome open source contributors πŸ’œ

Open source, MIT licensed

Statically-typed, functional

Influences: Haskell, Erlang, Frank..

Currently alpha testing 1st release!!

The goal: πŸ¦„ 🌈 πŸŽ‰

... by rethinking anything and everything about programming

factorial n = product (range 1 (n+1))
blah      n = product (range 1 (n+1))
blah2     z = product (range 1 (z+1))

Content-addressed code

#j1ejquc
src/
  math.u
  list.u
.unison/
  j1ejquc/
    ast.ub
    names/
      factorial
      blah
  8h7jbs5/
factorial n = product (range 1 (n + 1))

factorial = 
  n -> #8h7jbs5 (#h9bwx9q 1 (#e2i3biw n 1))
  
factorial = 
  $arg1 -> #8h7jbs5 (#h9bwx9q 1 (#e2i3biw $arg1 1))

Content-addressed code

.unison/
  j1ejquc/
    ast.ub
    names/
      factorial
      blah
  8h7jbs5/

Unlike names, hashes uniquely identify

No builds, easy renames, test caching...

Benefits

Easy typed, durable storage

No dependency conflicts

Programs that deploy themselves + describe whole elastic distributed systems

Easy renames

.unison/
  j1ejquc/
    ast.ub
    names/
      factorial
.unison/
  j1ejquc/
    ast.ub
    names/
      transmogrify

πŸ”½Β  rename factorial transmogrify

... and this breaks no one πŸ¦„ 🌈 πŸŽ‰

myFactorialTest = expect (factorial 5 == 120)

No builds

.unison/
  j1ejquc/
    ast.ub
    type.ub
    names/factorial

... and no one else needs to build it either!! πŸ¦„ 🌈 πŸŽ‰

myFactorialTest = expect (factorial 5 == 120)

Caching test results

.unison/
  30hbxzj/
    ast.ub
    type.ub
    evaluated.ub
    names/myFactorialTest

Definition for a hash never changes

Append-only 🌈 πŸ¦„

Cache never invalidated

So we can cache all kinds of info

Eliminating dependency conflicts

A (v1)

C

B

D

Employee, giveRaise ...

A (v2)

Employee, giveRaise ...

C

When defs "compete for a name"

What are conflicts, really?

A totally artificial problem

alice.smtp.Email and bob.web.Email

OK to allow N versions of "same" lib

No builds, easy renames, test caching...

Benefits

Easy typed, durable storage  ⭐️

No dependency conflicts

1 OS process

πŸ“œ

List Employee

Bytes, JSON,SQL

πŸ“œ

v2

Bytes, JSON,SQL

⏱

v1

List Employee

No builds, easy renames, test caching...

Benefits

Easy typed, durable storage

No dependency conflicts

Programs that deploy themselves + describe whole elastic distributed systems ⭐️

Alice

Bob

"evaluate: #8qkdu9x 7"

"missing dep: #8qkdu9x"

"here's definition #8qkdu9x: ..."

"result of factorial 7: 5040"

πŸƒβ€β™‚οΈ

"evaluate: factorial 7"

Alice

n-382948

"evaluate: factorial 7"

"missing dep: #8qkdu9x"

"here's definition #8qkdu9x: ..."

"result of factorial 7: 5040"

πŸƒβ€β™‚οΈ

factorialAt : Node ->{Remote} Nat
factorialAt bob = 
  r1 = at bob '(factorial 7)
  r2 = at spawn '(factorial 8)
  force r1 + force r2
dsort : (a -> a -> Boolean) -> [a] ->{Remote} [a]
dsort lte as =
  if size as < 2 then as
  else case halve as of (left, right) ->
    resL = at spawn '(dsort lte left)
    resR = at spawn '(dsort lte right)
    merge lte (force resL) (force resR)

Distributed programming as a library

ability Remote where
  at    : Node -> '{Remote} a -> Future a
  force : Future a -> a
  spawn : Node
Remote.runLocal '(dsort hugeDataset)

Cloud.usEast.run '(dsort hugeDataset)

Batch computing (local state only)

ability Remote where
  at    : Node -> '{Remote} a -> Future a
  force : Future a -> a
  spawn : Node

What about stateful elastic services?

unisonweb.org, @unisonweb

Thanks!!

Get together at The Sliced Pint @6pm tonight

#unison in Strange Loop slack

πŸ’œ πŸ™Œ contributors: Arya Irani, RΓΊnar Bjarnason, Chris Gibbs, Noah Haasis, Francis De Brabandere, Matt Dziuban, Ben Fradet, Billy Kaplan, Tomas Mikula, William Carroll, Scott Christopher, Alex Zolotko, Ian Denhardt, Mitchell Rosen, Ian Jeffries, Elliot Wu

Β 

Unison: Strange Loop 2019

By Paul Chiusano

Unison: Strange Loop 2019

Presentation on Unison from Strange Loop 2019

  • 2,144
Loading comments...

More from Paul Chiusano