Skip to main content

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

PackageCoverageDescription
baseExtensiveCore R functions: paste, nchar, sum, mean, c, length, is.*, etc.
statsCore functionst.test, lm, cor, sd, var, median, etc.
dplyrCore verbsfilter, select, mutate, summarise, group_by, arrange, etc.
ggplot2Core APIggplot, aes, geom_*, labs, theme, etc.
tidyrCore functionspivot_longer, pivot_wider, separate, unite, nest, etc.
purrrCore functionsmap, map_chr, map_dbl, map_lgl, reduce, keep, etc.
readrCore functionsread_csv, read_tsv, write_csv, etc.
stringrCore functionsstr_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.