Hacker News new | ask | show | jobs
by mikelyons 2364 days ago
> defunctionalization, a transformation that replaces higher-order functions with equivalent first-order ones.

For anyone else who got nothing from the title.

1 comments

I admit to fawning for functional languages like Haskell, Clojure and OCaml for fun, but it seems like they are not more popular because having many additional, higher-order constructs makes code “obsfucated” behind clever features rather than written as simply as possible (but no simpler). Maybe for a coding shop full of insane geniuses (i.e., quants, CalTech aerospace, physicists or Stanford research department) it’s all good, but the learning curve of tight functional code is too steep in the vast majority of situations. Even if it’s good, clean and small code, functional is too often a “white elephant” because of the dearth of its practitioners. Hence the pervasiveness of C++, Java, .NET, Python and especially JS.

One the fundamental UX, copy-writing, devops/sysadmin and programming axioms is:

Don’t make me think

e.g., reduce cognitive load by making knowledge works as easy to digest as possible using simple, familiar/conventional, intentional and clear patterns.

This genius talk is so wrong. I have an bachelors in engineering from a state school. I've worked in Haskell with multiple people with no computer science education. You don't need to be a genius to know Haskell, and knowing Haskell doesn't make you a special genius.

And in my experience, the Haskell codebases I've worked in best exemplify the axiom you mention. I've solved so many problems by barely using my brain thanks to FP.

The main prerequisite is a good attitude.

What are the ergonomics-first languages of the functional world?
I would say that rust and kotlin are good at providing most of the useful concepts from functional programming (higher order functions, common functors (map, filter, etc), tail call, pattern matching, destructuring, expressions, lazy evaluation, immutable collections, actor model, algebraic data types) Sadly they lack some features at the type system level (higher kinded types, intersection and union types) TypeScript do a better job at it but lack some other features (pattern matching).
Looks like the language you wanted to mention is Scala. Pragmatic and has all the things you mentioned.
Kotlin doesn't have destructuring pattern matching.
LISPers would say LISP.
TXR Lisp, for one.
Clearly, but a subset of functional features help to reduce cognitive load. And this subset is what modern languages target (see my comment below).