HeadlinesBriefing favicon HeadlinesBriefing.com

Why Currying Isn't Always the Best Choice in Functional Programming

Hacker News •
×

A Hacker News post challenges the prevailing wisdom that curried functions are essential for partial application in functional programming. The author argues that while currying offers elegance and free partial application, it creates intermediate function objects and complex types, obscuring data flow. Tuple style definitions, combined with simple syntactic sugar like the 'hole operator' ($), provide equally powerful partial application with clearer type signatures and more intuitive data flow. This approach avoids the overhead of currying's nested function creation and presents a more logical type unification, where input is a tuple and output is a single value.

The author finds the resulting code more readable and directly reflects the data transformation process.