Skip to content

Quick Start

To install Juvix, follow the instructions in the installation guide.

After installation, run juvix --help to see the list of commands.

Run Juvix doctor to check your system setup:

juvix doctor

CLI Usage Examples

Create a new package:

juvix init

Evaluate a source file:

juvix eval path/to/source.juvix

Compile a source file into a native executable:

juvix compile path/to/source.juvix

Compile a source file into a WebAssembly binary:

juvix compile -t wasm32-wasi path/to/source.juvix

Launch the REPL:

juvix repl

Typecheck a source file:

juvix typecheck path/to/source.juvix

Generate HTML representations of a source file and its imports:

juvix html --recursive path/to/source.juvix

The Hello World example

This is the Juvix source code of the traditional Hello World program.

-- HelloWorld.juvix
module HelloWorld;

import Stdlib.Prelude open;

main : IO := printStringLn "hello world!";

To compile and run a binary generated by Juvix, save the source code to a file called HelloWorld.juvix and run the following command from the directory containing it:

juvix compile HelloWorld.juvix
./HelloWorld

You should see the output: hello world!

The source code can also be compiled to a WebAssembly binary. This requires some additional setup. See the Installation How-to for more information. You can also run juvix doctor to check your setup.

juvix compile --target wasm32-wasi HelloWorld.juvix
wasmer HelloWorld.wasm