Exporting functions created with purrr adverbs in your package requires some precautions because the functions will contain internal purrr code. This means that creating them once and for all when the package is built may cause problems when purrr is updated, because a function that the adverb uses might no longer exist.
Instead, either create the modified function once per session on package load or wrap the call within another function every time you use it:
Using the
.onLoad()
hook:#' My function #' @export <- function(...) "dummy" insist_my_function <- function(...) { my_function # Implementation } <- function(lib, pkg) { .onLoad <<- purrr::insistently(my_function) insist_my_function }
Using a wrapper function:
<- function(...) { my_function # Implementation } #' My function #' @export <- function(...) { insist_my_function ::insistently(my_function)(...) purrr }