Skip to content

stylix: cleanup mkTarget impl#1512

Closed
0xda157 wants to merge 1 commit intonix-community:masterfrom
0xda157:mkTarget-cleanup
Closed

stylix: cleanup mkTarget impl#1512
0xda157 wants to merge 1 commit intonix-community:masterfrom
0xda157:mkTarget-cleanup

Conversation

@0xda157
Copy link
Copy Markdown
Contributor

@0xda157 0xda157 commented Jun 16, 2025

inspired by #1368 (comment)

CC @MattSturgeon @Flameopathic @trueNAHO

Things done

Notify maintainers

@0xda157 0xda157 force-pushed the mkTarget-cleanup branch 6 times, most recently from 50cf9cd to 1c0c7ea Compare June 16, 2025 23:54
Copy link
Copy Markdown
Contributor

@Flameopathic Flameopathic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure that the function naming is perfect, but honestly I don't think it ever will be. Code looks nicer now, though! Thanks for the cleanup.


# Call the configuration function with its required Stylix arguments.
mkConfig = fn: fn (getStylixAttrs fn);
applyArgs = fn: fn (getArgs fn);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we actually need a function to apply getArgs to a function, when we already have a function to easily get the args?

I.e. is applyArgs foo actually better than foo (getArgs foo)?

I ask, because I'm wondering if it'd be more useful to have a maybeApply, used like maybeApply foo (getArgs foo):

maybeApply =
  maybeFn: args:
  if isFunction maybeFn then maybeFn args else maybeFn;

But I think the current applyArgs would break that abstraction 🤔

Copy link
Copy Markdown
Member

@trueNAHO trueNAHO Jun 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we actually need a function to apply getArgs to a function, when we already have a function to easily get the args?

I.e. is applyArgs foo actually better than foo (getArgs foo)?

With the previous mkConfig terminology, it seemed obvious to provide this wrapper. Now, it would simplify the code by inlining this applyArgs function.

I ask, because I'm wondering if it'd be more useful to have a maybeApply, used like maybeApply foo (getArgs foo):

maybeApply =
  maybeFn: args:
  if isFunction maybeFn then maybeFn args else maybeFn;

But I think the current applyArgs would break that abstraction 🤔

I think it is better to keep the explicit if builtins.isFunction c then conditionalConfig c else c case in the main loop, as currently done.

@0xda157 0xda157 force-pushed the mkTarget-cleanup branch from 4a2caa2 to 2ffa39c Compare June 26, 2025 20:53
@stylix-automation stylix-automation bot added status: merge conflict Merge conflict and removed status: merge conflict Merge conflict labels Jun 28, 2025
@trueNAHO
Copy link
Copy Markdown
Member

Superseded-by: #1721

@0xda157 0xda157 closed this Jul 19, 2025
@0xda157 0xda157 deleted the mkTarget-cleanup branch July 19, 2025 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants