fuse

Fuse is a statically typed, purely functional language. It compiles to the GRIN whole-program optimizer, producing LLVM-generated native code.

type List[A]:
    Cons(h: A, t: List[A])
    Nil

trait Functor[A]:
    fun map[B](self, f: A -> B) -> Self[B];

impl List[A]:
    fun fold[A, B](l: List[A], z: B, f: (B, A) -> B) -> B
        match l:
            Cons(h, t) => List::fold(t, f(z, h), f)
            Nil => z

    fun sum(l: List[i32]) -> i32
        List::fold(l, 0, (a, b) => a + b)

impl Functor[A] for List[A]:
    fun map[B](self, f: A -> B) -> List[B]
        List::fold(self, Nil[B], (t, h) => Cons(f(h), t))

fun main() -> i32
    let l = Cons(1, Cons(2, Cons(3, Nil)))
    let l2 = l.map(x => x * 2)
    let s = List::sum(l2)
    print(int_to_str(s))
    0

Features

Statically typed

Based on System F with higher-order polymorphism. Algebraic data types, generics, and traits give you powerful tools to model your domain.

Purely functional

Every function in Fuse is a pure function. Pattern matching, higher-order functions, and do notation let you write expressive, composable code.

Type inference

Bidirectional type checking with support for higher-order types. Only function type signatures are required, for readability and verbosity. Everything else is inferred.

Clean syntax

Drawing inspiration from Rust, Python, Scala, and Haskell to bring a readable syntax to purely functional programming. Indentation-based blocks, lambda expressions, and do notation keep code clean and approachable.

Compiles to GRIN

Whole-program optimization through GRIN and code generation via LLVM produces fast, small native binaries with zero-cost abstractions.

Install Fuse

Get the Fuse toolchain on Linux (x86_64) or macOS (ARM64).

curl -fsSL https://fuselang.github.io/fuse/fuseup | sh