Skip to content

Commit

Permalink
docs: fix constructor sig take 2
Browse files Browse the repository at this point in the history
  • Loading branch information
arbelt committed Dec 2, 2024
1 parent dfaf9b1 commit 321d7ac
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
22 changes: 15 additions & 7 deletions R/lens.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
#' - **View-Set**: `set(d, l, view(d, l)) == d`
#' - **Set-View**: `view(set(d, l, x), l) == x`
#' - **Set-Set**: `set(set(d, l, x), l, y) == set(d, l, y)`
#'
#' These laws are not enforced by `tinylens`, but you should strive to follow them
#'
#' These laws are not enforced by `tinylens`, but you should strive to follow them
#' when creating your own lenses.
#'
#' A best effort has been made to ensure that these laws hold for the lenses
Expand All @@ -24,8 +24,16 @@
#' # create a trivial identity lens
#' l <- lens(view = function(x) x, set = function(x, value) value)
lens <- S7::new_class("lens",
package = packageName(),
properties = list(
"view" = NULL | class_function,
"set" = NULL | class_function
))
package = packageName(),
properties = list(
"view" = NULL | class_function,
"set" = NULL | class_function
),
constructor = function(view, set = NULL) {
S7::new_object(
S7::S7_object(),
view = view,
set = set
)
}
)
2 changes: 1 addition & 1 deletion man/lens.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 321d7ac

Please sign in to comment.