Get started
This page takes you from a fresh install to a running, tested and formatted project. It assumes a Linux x86-64 machine or an x86-64 WSL 2 distribution.
Install
Run the one-line installer:
curl --proto '=https' --tlsv1.2 -fsSL https://github.com/mirged/maylang/releases/latest/download/maylang-init.sh | shPress Enter to accept the recommended setup, or choose Customize setup to pick a folder, individual tools and shell integration. Open a new terminal when it finishes, or run the activation command it prints.
Check the installed tools:
may --version
mayc --versionCreate a project
may new hello
cd hello
may runmay new writes a workspace with may.json, an application entry point, a test group and a .gitignore. may run builds the application and executes it.
The generated may.json names the application and its test group:
{
"schema": 1,
"name": "hello",
"default": "app",
"targets": {
"app": {"kind": "app", "entry": "src/main.may"},
"tests": {"kind": "test", "root": "tests"}
},
"dependencies": {}
}Edit the program
Replace src/main.may with a program that uses a function, a list and a recoverable failure:
fun double(value: Int) -> Int {
return value * 2;
}
let values: List<Int> = [1, 2, 3];
let doubled: List<Int> = map(values, fun(value: Int) -> Int {
return double(value);
});
let answer: Int = may {
double(21)
} otherwise {
0
};
print(doubled);
print(answer);Output
[2, 4, 6]
42may evaluates the block and catches a recoverable fault. otherwise runs only when the block faults; err.kind and err.message are available inside it.
Test, check and format
may test
may check --all
may fmtmay test compiles and runs every *.test.may file under the declared test root. may check runs the type checker without producing an executable. may fmt formats the workspace sources; may fmt --check reports files that would change.
Next
- Take the tour for one concept at a time.
- Read the strict typing guide before writing a larger program.
- Browse the standard library.