flyd icon indicating copy to clipboard operation
flyd copied to clipboard

Inconsistent argument order in takeuntil

Open zspecza opened this issue 7 years ago • 3 comments

Given this excerpt from the readme, I assume all flyd modules should accept the operation data as the last parameter:

More functional in style. Flyd is more functional than existing FRP libraries. Instead of methods it gives you curried functions with arguments in the order suitable for partial application. This gives more expressive power and modularity.

Why does takeuntil deviate from this paradigm? Is there a specific reason?

To me, takeuntil(endStream, source) makes more sense.

I can make a pass at a PR for this, just want to find out if it's not an important design decision that I'm missing the point of first.

zspecza avatar Jul 18 '16 15:07 zspecza

This bit me today. Should I make a PR?

irisjae avatar Feb 02 '17 13:02 irisjae

In fact, as a side note, I found many of the modules listed to be the causes of problems which disappeared once I replaced them with flyd.transduce and Ramda. Perhaps, either they should be much more scrutinized, or just drops those which have Ramda equivalents.

irisjae avatar Feb 02 '17 14:02 irisjae

I agree, this is very surprising behaviour.

I think we need to either

  1. Flip the argument order
  2. Document why this is the argument order in the readme for takeuntil

Personally I always import takeuntil like this

import * as takeuntil from 'flyd/module/takeuntil';
const takeUntil = R.flip(takeuntil);

nordfjord avatar Jan 28 '18 17:01 nordfjord