articulate/funky

Curried Function Lengths Are Wrong

mgreystone opened this issue · 4 comments

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. #35

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

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.

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

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.