programs are deterministic, dependencies are immutable
run anywhere, managed effects allow programs to declare runtime requirements
A sound structural type system guarantees programs never crash
let user = {age: 71, name: "Eve"}let total = !int_add(10, "hello")let address = user.addresssumtype missmatch given: Integer expected: Stringmissing row 'address'missing variable 'sum'
let message = "I've just finished the EYG introduction"match perform Twitter.Tweet(message) {Ok (_) -> "Tweeted successfully"Error (_) -> "Failed to send tweet."}Will run Twitter.Tweet effect. click to continue.
let exec = (_) -> {let _ = perform Alert("hello world!")"done"}handle Alert((value, resume) -> {let {alerts: alerts, return: return} = resume({}){alerts: [value, ..alerts], return: return}},(_) -> {let return = exec({}){alerts: [], return: return}},){alerts: ["hello world!"], return: "done"}
let {http: http} = @std:1let request = http.get("catfact.ninja", "/fact")match perform Fetch(request) {Ok ({body: body}) -> !binary_to_string(body)Error (_) -> Error({})}missing reference #@std:1
let script = (closure) -> {let js = !to_javascript(closure, {})!string_append("<script>", !string_append(js, "</script>"))}let name = match perform Prompt("What is your name?") {Ok (value) -> valueError (_) -> "Alice"}let client = (_) -> {let message = !string_append("Hello, ", name)let _ = perform Alert(message){}}let page = script(client)let page = !string_to_binary(page)perform Download({name: "index.html", content: page})Will run Prompt effect. click to continue.
let initial = 10let handle = (state, message) -> !int_add(state, 1)let render = (count) -> {let count = !int_to_string(count)!string_append("the total is ", count)}{render: render, handle: handle, init: initial}
App state
Rendered app, click to send message