EYG

A programming language for predictable, useful and confident development.

Penelopea, EYG's mascot

Predictable:

programs are deterministic, dependencies are immutable

Useful:

run anywhere, managed effects allow programs to declare runtime requirements

Confident:

A sound structural type system guarantees programs never crash

Never crash

Guarantee that a program will never crash by checking it ahead of time. EYG can check that your program is sound without the need to add any type annotations.
EYG's type system builds upon a proven mathematical foundation by using row typing.
let user = {age: 71, name: "Eve"}
let total = !int_add(10, "hello")
let address = user.address
sum
type missmatch given: Integer expected: String
missing row 'address'
missing variable 'sum'
Click on error message to jump to error.

Run anywhere

EYG programs are all independent of the machine they run on. Any interaction with the world outside your program is accomplished via an effect.
A runtime can make an effect available. For example all snippets on this EYG homepage have access to this Tweet effect
Read more about the effects
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.

Manage side effects

All interactions to the world outside a program are managed as effects.
Any effect can be intercepted using a handler. This allows the response from the outside world to be replaced.
Handling effects is great for testing; if all effects are handled then your program is deterministic. No more flakey tests.
Read the effects documentation.
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"}
Click above to run and edit.

Named references

Use an ecosystem of helpful packages to work faster. Share code with anyone using your unique handle.
Signing up for account names is in closed beta for now. Get in touch to find out more
Read the reference documentation.
let {http: http} = @std:2
let request = http.get("catfact.ninja", "/fact")
match perform Fetch(request) {
Ok ({body: body}) -> !binary_to_string(body)
Error (_) -> Error({})
}
missing reference #@std:2

Cross boundaries

Closure serialisation allows functions to be efficiently transformed back into source code and sent to other machines.
Build client and server as a single strongly typed program. Even extend type guarantees over your build scripts.
Other languages have the possiblity of closure serialisation, but EYG's runtime is designed to make them efficient.
Read the reference documentation.
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) -> value
Error (_) -> "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.

Hot code reloading

Use EYG's structural type system to validate that updates will work ahead of time
In this example you can increment the counter by clicking the rendered app. If you change the code the behaviour will update immediatly if safe. If the code changes modify the type then you will be asked for a migrate function.
Stay up to date join the mailing list.
let initial = 10
let 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}
{handle: (state) -> { ... }, init: 10, render: (count) -> { ... }}

App state

0

Rendered app, click to send message

the total is 0

Iterate fast with a shell

EYG already has a prototyped strongly typed shell environment.
We need to get it ready and bring it to you.
Stay up to date join the mailing list.

An ecosystem of runtimes

EYG is built to support multiple runtimes. You have already seen this with closure serialisation
In the future EYG will be available in many more places, e.g. arduino, CLI's and IPaaS.
EYG makes this easy by having a carefully designed minimal AST.
Stay up to date join the mailing list.
Want to stay up to date?
Join our mailing list.