Skip to content
Ridgun
English

Projects with stable

Create a project, run it, test it, format it and build it with one tool.

A single file is enough to try things out. For anything larger, use stable:

stable new hello
cd hello
stable run

stable new creates this layout:

hello/
  build.rg                       the project: name, entry point, folders, dependencies
  src/main/ridgun/hello/main.rg  the program
  src/test/ridgun/               the tests

build.rg is written in Ridgun too. Each setting is a function:

fn :: project name => String
      project name =  "hello"

fn :: dependencies => [String]
      dependencies =  []

The daily commands

CommandWhat it does
stable checkChecks the types of every module.
stable testBuilds and runs every test in src/test/ridgun/.
stable formatAligns every .rg file into the canonical columns.
stable builtBuilds the executables into target/.
stable runBuilds the program if needed, then runs it.
stable depsFetches the dependencies listed in build.rg.

A test

Tests import test and use assert equals and assert true:

import test

fn :: double Int => Int
      double x   =  x * 2

fn :: main => ()
      main =
        assert equals (double 21) 42
        assert true ((double 5) > 0)

Libraries

stable new --lib geometry creates a library. stable built lib turns it into a .rglib bundle and a native .so, which other projects import with import geometry.

Next, set up your editor.