Skip to main content

Fuyu

A concurrent functional programming language

import std/iter
import std/task

export def sum_in_parallel(numbers: List[Int]) -> Int {
let half = len(numbers) / 2
let (left, right) = (numbers[..half], numbers[half..])
let (sender, receiver) = channel()
async() {
task::start() { sender | send(iter::sum(left)) }
task::start() { sender | send(iter::sum(right)) }
}
iter::sum(receiver)
}

👀 Stay tuned! Fuyu is not yet released. Follow progress on the GitHub repository .

Fuyu is a concurrent functional programming language designed around the idea that a small number of orthogonal yet cohesive features make code easy to read, write, and reason about.

Easy to understand

Fuyu has just four kinds of entities: types, values, functions, and implicits. Combine these to express complex ideas with surprising ease, all while maintaining a clean and readable codebase

Statically typed

The types of every expression are verified at compile time. If any types are inconsistent, the compiler rejects the program. This process eliminates an entire class of errors before the program is executed.

Type inference

Omit type annotations to reduce visual clutter while maintaining type safety. Type annotations are required for functions, and the compiler will determine the types for the rest.

Implicits

The compiler automatically inserts implicit arguments to functions based on the context in which the function is used. These are commonly used for polymorphic behaviors, but can also be used for more advanced techniques, such as creating domain-specific languages.

Concurrency

Spawn hundreds of thousands of lightweight tasks to tackle problems concurrently. Fuyu employs structured concurrency to ensure predictable behavior, making it easy to manage tasks and keep programs under control.

Immutability

All values are immutable, allowing them to be safely shared between concurrent tasks without the need for synchronization. Programs are easier to understand because values remain constant after they are created.