Getting started
1. Why this language
TypR is a powerfull datascience/software engeneering programming language and a typed version of the R language that introduces an optional static type system, while preserving the flexibility and expressiveness that make R a powerful tool for data analysis and statistics.
Its main goals are:
- Reduce runtime errors through early detection (at writing or compilation time).
- Improve readability and maintainability of medium- to large-scale R projects.
- Facilitate teamwork by making function contracts and data structures explicit.
- Prepare R code for production use, without giving up the existing ecosystem.
TypR aims to strike a balance: more rigor when needed, without sacrificing productivity.
You can read more about this topic with it's core philosophy.
2. What TypR is not
Not a R's replacement
R is a powerful programming language for research, exploration, experimentation and visual production for data analysis and statistics. TypR is there to handle another set of activity going from package production/maintenance to live application scalability in production.
Not a low level R
Even though, in the future types will help building faster code, their goal is more about data modeling and safety.
Target audience
This language is primarily intended for:
- Data scientists and statisticians who use R and want more reliable analyses.
- Developers working on complex or mission-critical R projects.
- Data teams in organizations seeking to standardize and secure their codebases.
- Researchers and educators who want to introduce sound software engineering practices into their work.
It is especially well suited for projects that go beyond simple exploratory scripts.
3. Prerequisites
To use TypR, it is recommended to:
- Have a basic knowledge of the R language (syntax, functions, data frames).
- Understand fundamental programming concepts (functions, variables, modules).
Experience in data science or statistics is a plus, but not strictly required.
4. Installation
Check the installation page.
5. First program
Here is a simple first example in TypR:
print("Hello world")
Here is another example doing the same thing but with type expressions
let hello: char <- "Hello world";
let my_print <- fn(msg: char): Empty {
print(msg)
};
my_print(hello)
Core concepts
Primitive types
TypR introduces explicit types for basic values:
- integer (int)
- numbers (num)
- booleans (bool)
- characters (char)
These types allow the compiler to check code consistency.
Functions
Typed functions
fn(a: int, b: int): int {
a + b
}
Functions can declare:
- the type of their parameters,
- the type of their return value.
This makes developer intent explicit and prevents many classes of errors.
Untyped functions
function(a, b) {
a + b
}
To keep a flexible way to interop with raw R code.
Data structures
Vectors
c(1, 2, 3, 4)
Lists
list(name = "Anna", age = 56)
or
:{name: "Anna", age: 56}
Going further
To deepen your use of TypR, you can:
- Explore advanced types
- Learn about integration with the existing R ecosystem (packages, scripts, notebooks).
TypR is designed to evolve alongside its users and their needs.