Scarlet Industries

The Scarlet language

A typed language built around cheap, isolated processes.

Scarlet is not finished. The syntax and the standard library still change between releases, so there is no manual yet, only the ideas we are building it on.

Principles

A small program

This restocks anything on the shelf that has run out, then prints the shelf.

import scarlet/array

type Item {
	name String
	count Int
}

fn restock(item Item) Item {
	match item.count {
		0 -> Item(..item, count: 12)
		_ -> item
	}
}

pub fn main() {
	shelf = [Item(name: 'tea', count: 4), Item(name: 'jam', count: 0)]
	println(array.map(shelf, restock))
}

Install Scarlet, save the program as shelf.scrl and run it:

curl -fsSL scarlet.industries/install.sh | bash
scarlet run shelf.scrl

A bigger program puts a web server in front of a stock room.