Built-in Declarations
Infr ships with type declarations for commonly used R packages. These .d.infr files describe function signatures so Infr can type-check calls to these packages.
Bundled packages
| Package | Coverage | Description |
|---|---|---|
| base | Extensive | Core R functions: paste, nchar, sum, mean, c, length, is.*, etc. |
| stats | Core functions | t.test, lm, cor, sd, var, median, etc. |
| dplyr | Core verbs | filter, select, mutate, summarise, group_by, arrange, etc. |
| ggplot2 | Core API | ggplot, aes, geom_*, labs, theme, etc. |
| tidyr | Core functions | pivot_longer, pivot_wider, separate, unite, nest, etc. |
| purrr | Core functions | map, map_chr, map_dbl, map_lgl, reduce, keep, etc. |
| readr | Core functions | read_csv, read_tsv, write_csv, etc. |
| stringr | Core functions | str_detect, str_replace, str_extract, str_split, etc. |
How declarations work
When you call a function like paste("hello", "world"), Infr looks up the function signature in its declarations:
# From base.d.infr:
paste <- function(...: character, sep: character = " ") -> character
Infr then checks:
- The argument types match the parameter types
- The return type is used correctly downstream
If a function is not declared, calls to it are unchecked — consistent with gradual typing.
Adding your own declarations
See Declaration Files for how to write .d.infr files for additional packages.
Contributing declarations
If you write declarations for a popular R package, consider contributing them back to the Infr project. Place the file in the declarations/ directory at the repository root and open a pull request.