Get Started
Install the Fuse toolchain and write your first program.
Install the Fuse toolchain
Run the installer to get everything you need:
curl -fsSL https://fuselang.github.io/fuse/fuseup | sh
This installs the complete toolchain:
- fuse compiler
- grin compiler (whole-program optimizer)
- LLVM tools (clang, opt, llc)
- Boehm GC (garbage collector)
- Runtime files
Supported platforms: Linux (x86_64) and macOS (ARM64).
After installation, open a new terminal or source your shell profile, then verify:
fuse --version
Write your first program
Create a file called hello.fuse:
fun main() -> IO[Unit]
print("Hello from Fuse!\n")Every Fuse program has a main function. print does not write to the terminal when you call it. It returns an IO[Unit], a value that describes the write. Returning that value from main is what performs it, and the program exits with status 0.
Run it
fuse run hello.fuse
Hello from Fuse!
fuse run compiles the program, runs it with your terminal attached, and removes the binary and the intermediate GRIN file afterwards. Any extra arguments are forwarded to the program itself, and fuse run exits with the program’s own exit code:
fuse run hello.fuse alpha beta
Check without running
To report type errors without producing a binary:
fuse check hello.fuse
On success it prints the inferred type of every binding to standard output and leaves no files behind.
Build a standalone binary
fuse build hello.fuse
This produces hello, a native executable named after the source with the extension removed, in the same directory. Run it like any other program:
./hello
A more complete example
Create a file called numbers.fuse. It uses sum types, generics, pattern matching, and methods, none of which need declaring, because they come from the standard library:
fun describe(o: Option[i32]) -> str
match o:
Some(v) => "value: " + int_to_str(v)
None => "nothing"
fun main() -> IO[Unit]
let l = Cons(1, Cons(2, Cons(3, Nil)))
do:
_ <- print(describe(Some(l.length())) + "\n")
_ <- print(describe(None[i32]) + "\n")
()fuse run numbers.fuse
value: 3
nothing
List, Option, Cons, Nil, Some, None, and length all come from Fuse’s standard library, which is always in scope. There is no import statement. The do: block sequences the two writes into a single action for main to return.
Next steps
Continue to the Overview to learn the language through annotated examples.