No matter how much I personally like functional programming, I know that it is not a one-size fits all solution for every problem.
Vald M knows this too. Which is why they sent us an email that simply said: “We have a functional programmer on the team”, with this representative line attached.
function groupByBreakdown (breakdowns) {
return R.pipe(
R.map(R.flatten),
R.zip(breakdowns),
R.map(R.apply(R.useWith(R.groupBy, [R.prop, R.identity])))
);
};
The use of R.pipe
is a good argument about why the proposed pipeline operator is a terrible idea whose time isn’t going to come. Ever. Yes, there’s value in being able to easily compose functions into a pipeline. Shells support pipelining for a reaason, after all. But it's an awkward fit into imperative languages, and unfortunately, the tool is too dangerous to be used in real-world code. Even functional languages, like Elixir, warn you against abusing the pipeline. Mixing opaque functional styles with JavaScript is just flirting with disaster. I mean, more disaster than JavaScript already is.