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
base: master
Are you sure you want to change the base?
Conversation
68bcbb6
to
a44aca3
Compare
There was a problem hiding this 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]) |
There was a problem hiding this comment.
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.
@CrossEye Shall we close this for now? |
@CrossEye I'm tempted to reopen as we have docs and test cases. Perhaps we can simply drop the type signature for now? |
Reopened, but with the focus on the signature, I don't remember ever really looking over those examples and docs. I like the I won't have time this evening, but I'll try soon to make suggested changes. |
#2396