Hello!
As in the title; what is the proper way to create a function along the lines of (self: { ... })
, and that has a default value that the caller can access as well? So far I’ve come up with the following:
test = { __functor = self: x: (x ((x self) // { c = 3; })) // { c = 3; }; }
Where calling it results in this:
test (self: { a = 1; b = self.a + 1; d = self.c + 1; })
# { a = 1; b = 2; c = 3; d = 4; }
However, I cannot access self
from within the functor.
Thank you kindly for the help!