typed-typings/npm-ramda

[Q] Why is compose `max_function_count` fixed to 6?

andys8 opened this issue ยท 5 comments

The params max_function_count: number and max_parameter_count: number are set both set to max_curry_level which is set to 6. Same for pipe and probably others.

https://github.com/types/npm-ramda/blob/8dd1f0c1aab32be3b9ee7fefe5fa097dcde67ec1/templates/compose.ts#L7

https://github.com/types/npm-ramda/blob/a090392bed87139dc07e3df4ab0cde8d5c35c32d/templates/pipe.ts#L5

https://github.com/types/npm-ramda/blob/8dd1f0c1aab32be3b9ee7fefe5fa097dcde67ec1/templates/%24curriedFunctions.ts#L5

I'm interested in the discussion and causes, why this limit was chosen. I could think of a pipe where somebody is composing more than 6 functions. One could discuss, if there could be opinions against it, but it would be valid code, that won't be type checked. Is this about performance? The output size? Is it related to currying? Or did the number "feel right"? I'm just curious.

Although, if nothing speaks against it, I'd would ask to raise the number of composed functions to a value above 6 :)

Mostly "feel right", but the performance and the out size are also concerns. I'm not sure if we should increase it but if there's no significant impact, it should be fine.

Actually, there are times when we need to compose a list of fns...

type Fn = (a: any) => any;
const list: Fn[] = [];
R.compose(...list); // Expected 1-6 arguments, but got 0 or more.

(Or do I have to reduce the list?)

R.reduceRight(R.compose, R.identity /* or first fn */, list);

Anyway I could work around this artificial limitation? I understand that I can always compose two other compose functions, but that doesn't sound like a good practice.

Please raise it. I cannot make beautiful pipelines in typescript just because of this stuff.

any updates on this? quite a horrrible limitation