Fork me on GitHub

Get Started

You can try Flix in your browser, install the Visual Studio Code extension, or use the command line via Homebrew, Nix, or the JAR.


Try Flix in your browser

The online playground compiles and runs Flix programs for you, with nothing to install.


Install the Visual Studio Code extension

Open the Extensions view, search for Flix, and click install. The extension brings the compiler with it, so there is nothing else to download.

Installing the Flix extension from the Visual Studio Code Extensions view
The extension is also available on the Visual Studio Marketplace and Open VSX.

Or use Flix from the command line

Flix is one self-contained tool: compiler, build tool, package manager, test runner, and REPL.

Homebrew

brew install flix

Nix

nix-shell -p flix

JAR

curl -L -o flix.jar https://github.com/flix/flix/releases/latest/download/flix.jar

Homebrew and Nix give you a flix command, so a project is flix init and then flix run. With the JAR, which works anywhere Java does, the same two are java -jar flix.jar init and java -jar flix.jar run.


Your first program

use Net.Http
use Net.HttpResponse.status

/// Fetching a URL uses the Http effect, so it appears
/// in the signature. Here it runs with the default
/// handler, which performs the actual HTTP request.
def main(): Unit \ { Http, IO } =
    match Http.get("https://flix.dev/") {
        case Ok(res)  => println("Status: ${status(res)}")
        case Err(err) => println("Failed: ${err}")
    }

The program fetches https://flix.dev/ and prints the status code that comes back, or the error if the request failed.

Http is one of many effects the standard library provides, alongside Clock, Console, FileSystem, Logger, Process, and Random. Each comes with a default handler, so a program can use them without any setup.

Http also comes with a lot of middleware: retries, circuit breakers, rate limiting, logging, base URLs, and default headers.


Where to go next

  • Programming Flix is the book: a detailed introduction to the language, from the basics, to the trait system, to effects and handlers.
  • Prefer Neovim, Emacs, or running the JAR directly? The book's getting started chapter covers every install route.
  • Questions, or stuck on something? Come and say hello on Zulip.