
A typed language that transpiles to R
Vapour makes R developers more confident in their programs: types, static checks and a cleaner syntax, compiled to plain R you can ship anywhere.
- Linux & macOS
- Go
curl -fsSL https://vapour.run/install.sh | sh
go install github.com/vapourlang/vapour@latest
Requires R. Prebuilt binaries for Linux, macOS, and Windows are also available, see installation.
1type user: object {2 age: int,3 name: char4}56func create(name: char): user {7 return user(name = name)8}910let john: user = create("John")1112# error: left expects int, right returns char13john$age = "thirty-six"
R, with guard rails
Separating the code you write from the code that runs means Vapour can check it first.
Types
Types aren't just for compilers, they help you too. Stop getting caught out by unexpected NULLs.
let x: char = "hello, world"# error: wrong typex = NULL
Robustness
Catch flagrant problems as you type, before they reach your users, or even your unit tests.
func foo(x: int): int {return x + 1}# warning: y not foundprint(y)
Syntax
Keep the whole R ecosystem, but let the syntax evolve faster than the language underneath, like ECMAScript for JavaScript.
let x: int = 1# increment in placex += 41
Write Vapour, ship R
Every Vapour file compiles down to plain R. No runtime, no dependency: your users only ever see R.
1type user: object {2 age: int,3 name: char4}56func create(name: char): user {7 return user(name = name)8}910@generic11func (p: any) set_age(age: int, ...: any): any1213@default14func (p: any) set_age(age: int, ...: any): null {15 stop("not implemented")16}1718func (p: user) set_age(age: int, ...: any): user {19 p$age = age20 return p21}2223let john: user = create("John") |>24 set_age(36)
1create <- function(name) {2 return(structure(3 list(4 name = name5 ),6 class = c("user", "list")7 ))8}910set_age <- function(p, age, ...) {11 UseMethod("set_age")12}1314set_age.default <- function(p, age, ...) {15 stop("not implemented")16}1718set_age.user <- function(p, age, ...) {19 p$age <- age20 return(p)21}2223john <- create("John") |>24 set_age(36)
Up and running in minutes
- 1
Install
Prebuilt binaries for Linux, macOS and Windows, or install with Go.
Install Vapour → - 2
Set up your editor
Syntax highlighting and LSP diagnostics for VS Code, Positron, Vim and Neovim.
Editor setup → - 3
Write your first program
Learn the syntax, the type system, and how to build packages with Vapour.
Get started →
What's next
Vapour is in early alpha. Here's where it's heading.
- 01
R type inference
Infer types from base R so type checking can be executed.
- 02
Autocompletion LSP
The LSP currently only provides diagnostics, it should also provide autocompletion (and maybe more).
- 03
Vapour type inference
Infer types in Vapour to reduce verbosity a tad.
- 04
Package development tools
Vapour could provide functionality similar to that of devtools.
- 05
Improve transpiler
The transpiler currently outputs valid but extremely ugly R code.
- 06
Formatter
Include a formatter.
- 07
Extensions
Allow extending Vapour, e.g.: with @decorators.
Help shape Vapour
It's early days: every contribution counts.