Getting started

Geng has not been released, and there is no installer yet. This page shows what a first program looks like with the compiler as it stands. See Status and roadmap.

Installation#

Not yet available.

Your first program#

A Geng application is a directory with a geng.toml file and a src/ directory. The manifest says which runtime the program is built for:

[application]
geng = "0.6.0 <= v < 0.7.0"
runtime = "node"

Create src/Main.geng:

module Main exposing (main)

import Console
import Task exposing (Task)


main : Task Never {}
main =
    Console.write "Hello, world!\n"

Then build and run it:

geng run Main

main is a Task: a description of work for the runtime to do. Never as its error type means every error must be handled before it reaches main, and {} means it produces no value. The program ends when main finishes.

Running on the BEAM#

The same program runs on the Erlang virtual machine. Change the manifest:

[application]
geng = "0.6.0 <= v < 0.7.0"
runtime = "beam"
target = "beam"

and run geng run Main again. On the BEAM, geng make builds an OTP application and an escript.

Running natively#

To build a Linux executable, change the manifest again:

[application]
geng = "0.6.0 <= v < 0.7.0"
runtime = "os"
target = "native"

This needs a C compiler: clang on your PATH, or the one the GENG_CC environment variable names. geng run Main builds the executable and runs it, and geng make Main builds it with optimizations on.

Next steps#