SodiumFRP / sodium-typescript

Typescript/Javascript implementation of Sodium FRP (Functional Reactive Programming) library
126 stars 17 forks source link

Curry the functions #51

Open dakom opened 6 years ago

dakom commented 6 years ago

I think all the function arguments should be curried so that we can call them either as (a,b,c) or a => b => c

Since we know the arity of all these functions, we can use an internal curry2, curry3 etc. rather than rely on inspecting the number of arguments etc.

Anyone opposed to this idea?

huanhulan commented 6 years ago

@dakom use the type definition of Haskell style is great, but that will need extra effort for the sodium's users to use and understand it since they are not using the Haskell and the Sodium is the frp lib for non-Haskell communities.

dakom commented 6 years ago

Right, by "currying" I mean like the way Ramda does it where you can provide the arguments in either style. It's a little more work on the library side, but that way it's usable in both styles.

In other words, the user is free to call it either like (a,b,c) or a => b => c. There's no obligation to use it like the latter.

(fwiw I'm getting more and more used to using unary functions everywhere... only a matter of time before I go full Haskell, hehe)

huanhulan commented 6 years ago

@dakom oh, I see what you mean, I think it is a good idea now.