Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
abandon Ramda-style currying in favour of simple currying
‘def’ has served two roles: - currying an uncurried implementation function; and - performing type checking at run time. At the time of this project's inception in 2015 it seemed unreasonable to require users to provide curried implementation functions. Defining curried functions manually was onerous prior to ES6: function(x) { return function(y) { return function(z) { return ...; }; }; } With ES6, defining curried functions is trivial: x => y => z => ... The landscape has changed since 2015, and it's now reasonable to assume that users are targeting ES6. Furthermore, the advantages of Ramda-style currying over simple currying do not justify the additional complexity. There's no compelling reason for ‘def’ to continue to serve two roles. User-facing changes: - ‘$’ functions must now be applied to arguments one at a time; - ‘def’ now requires a curried implementation function; - ‘def’ no longer imposes an arbitrary arity limit; - ‘def’ functions must now be applied to arguments one at a time; and - ‘__’ has been removed (simple currying precludes placeholders). Internal changes: - the ‘checkTypes’ option is now checked in just one place; and - ‘def’ is now essentially a no-op if type checking is disabled.
- Loading branch information