forked from Fediversity/Fediversity
factor out function wrapper to module function #9
No reviewers
Labels
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: fricklerhandwerk/Fediversity#9
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "data-model-factor-out-wrapper"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
lifts the
{ input output }
function wrapper out of the user interface tofunction.nix
, simplifying usage.pre-#13 comments
note that this does not yet add a value-level 'type check' using this type yet, as such a check does not seem to function yet anyway. as such, the point of havingfunction.nix
here is to allow for structured type data for the purpose of documentation generation, as suggested at Fediversity/Fediversity#481 (comment).if we figure out how to make such a type-check work, something like it could be added in
data-model.nix
like:... or even to
function.nix
itself, like:factor out function wrapper to module functionto WIP: factor out function wrapper to module functionmarked as WIP again to rebase on #13 (if at all compatible)
@fricklerhandwerk my update for #13 here so far worked by duplicating stuff from
function.nix
- the next step seems figuring out how to resolve that duplication, which i hope you might have some insights on.WIP: factor out function wrapper to module functionto factor out function wrapper to module functionok i'm sorta happier about this now, reviews welcome
implementation
todeclare
, mirroringapply
d066b1d55ci feel like UX-wise there is room for further encapsulation still - my ideal level of abstraction would be like a
types.functionFromTo
(mirroring the existingtypes.functionTo
) to be used asmkOption { type = types.functionFromTo input-type output-type; default = implementation; }
.one difference may be we do actual type-checks, while i'm under the impression
types.functionTo
does not.moreover tho, given my current level of encapsulation, an outstanding challenge to exposing such a transparent encapsulation would be that, as it stands, such a type would not amount to a no-op for the value: the (typed) function we get out (currently:
apply
) is not the (untyped) function we put in (currently:declare
).now, while nix (afaik) lacks OOP-style getters/setters, i felt like there is a certain level of precedent here in the sense one already cannot just comment type declarations and expect things not to break, e.g. due to
submodule
s declaring calculated attributes throughreadOnly
default values.i'll have to admit tho, i'm not actually sure it's possible in current nix to reach such a further level of encapsulation here.
kiara referenced this pull request from Fediversity/Fediversity2025-08-27 12:11:43 +02:00
superseded by Fediversity/Fediversity#503.
Pull request closed