Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposed documentation and unit tests for #2396 #2401

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

JLRishe
Copy link

@JLRishe JLRishe commented Nov 29, 2017

Copy link
Member

@CrossEye CrossEye 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 I see any great signature, but the one changed here simply confuses me.

Everything else looks good.

* producing the values for these properties.
* @return {Function} A function that returns an object of the same structure
* as `spec', with each property set to the value returned by calling its
* @sig {k: ((a, b, ..., m) -> v)} | [((a, b, ..., m) -> v)] -> ((a, b, ..., m) -> {k: v} | [v])
Copy link
Member

Choose a reason for hiding this comment

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

I'm not really sure how to write a good signature for this with its recursive nature as well as the variadic functions. But this one simply confuses me.

I don't know if we're better with a list of related signatures, but they would at least individually be much simpler:

applySpec :: {k: a -> v} -> (a -> {k: v}
          :: {k: (a, b) -> v} -> ((a, b) -> {k, v})
          :: {k: (a, b, c) -> v} -> ((a, b, c) -> {k, v})
          :: ...
          :: {[(a -> v)] -> (a -> [v]) 
          :: {[((a, b) -> v)] -> ((a, b) -> [v]) 
          :: {[((a, b, c) -> v)] -> ((a, b, c) -> [v]) 
          :: ...

But that still does not capture the recursive nature of this. I now very much regret that this is recursive; we seem to have abandoned our focus on simplicity here.

@customcommander
Copy link
Member

@CrossEye Shall we close this for now?

@CrossEye CrossEye closed this Jan 22, 2022
@customcommander
Copy link
Member

@CrossEye I'm tempted to reopen as we have docs and test cases. Perhaps we can simply drop the type signature for now?

@CrossEye CrossEye reopened this Feb 25, 2022
@CrossEye
Copy link
Member

Reopened, but with the focus on the signature, I don't remember ever really looking over those examples and docs. I like the [dec, identity, inc] one, but I'm less thrilled with the always('add') one. In all of these cases, I'd rather use simple arrow functions than require someone to understand other Ramda functions to follow the docs for this one.

I won't have time this evening, but I'll try soon to make suggested changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants