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

Curried Function Lengths Are Wrong #34

Closed
mgreystone opened this issue Oct 22, 2019 · 4 comments · Fixed by #40
Closed

Curried Function Lengths Are Wrong #34

mgreystone opened this issue Oct 22, 2019 · 4 comments · Fixed by #40
Assignees

Comments

@mgreystone
Copy link
Member

mgreystone commented Oct 22, 2019

The use of uncurryN is causing functions to return with incorrect lengths. See #26 .

Examples:

const arity2 = (a, b) => {}

// In funky 1.3.1, these all have a length of 2
// In funky 1.4.2, these all have a length of 1
combineAll([ arity2 ]).length
combineAllP([ arity2 ]).length
combineWith(merge, arity2).length

Options:

  1. Force all returning functions to be unary functions.
  2. Follow the "ramda" pattern to force function lengths to be evaluated during compositon.
    In other words, remove auto curry. Force combineAll(arr)(data) & drop support for combineAll(arr, data). Ramda does not allow juxt(arr, data) for this exact reason.
  3. Attempt to apply auto curry magic. Fix Function Arities #35
@rpearce
Copy link
Contributor

rpearce commented Oct 22, 2019

If no. 3 creates more trouble than it's worth, I am ok with no. 2 and living with that

@mgreystone
Copy link
Member Author

My vote continues to be for option 2. I'm not interested in taking #35 any further, but @rpearce (or anyone) please feel free to bang on it.

@rpearce
Copy link
Contributor

rpearce commented Oct 22, 2019

I'm with you, then. @flintinatux: any opinions?

@flintinatux
Copy link
Contributor

Depends on which convention we want to follow. I intentionally decided to make tinyfunk only support unary functions, partially for this reason, and partially because it makes the code so much simpler. But ramda tries to support all-the-things. If that's us too, then it's ok to follow the same patterns as ramda.

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