comments
Submitted yesterday evening on opam, merged early this morning, with a kind word from the maintainer. It's really fast. The OCaml community is a lovely place.


The problem isn’t so much the side effect as it is the ability to introduce side effects arbitrarily with no warning to someone using your functions
Yes, I try to allude to this in the "caution" and "tldr2" sections, but I think I could have been more clear. You are right that for many people it's not so much about avoiding side effects as it is about coming up with ways to use them carefully. Stateful monads and clojure's atoms/refs were in fact what I had in mind. And debating the pros/cons of these techniques is indeed a good conversation on its own! What I mostly wanted to get across is that fp is not about programming without side effects. All the good debate is about the extent to which we should try to avoid side effects, and what techniques we should use when doing so.
I think it’s also really important to call out the concept of total functions
Yeah I think this is totally (heh) worth talking about, and a much better topic than pure functions. I only didn't mention it because I don't see it brought up too often.
This reads like a parody to me. They almost seem to be trying to find a way to warp and misunderstand even the most basic concepts to contort themselves to miss the point. I honestly am baffled as to how such a seemingly-contrived misinterpretation of absolutely everything at every step of the way could happen by accident. But I suppose the internet is a billion monkeys at a billion typewriters so maybe it had to happen eventually.
I think he's far too quick to dismiss the idea of no side effects. Or rather I think he's taking an absolutist stance. The problem isn't so much the side effect as it is the ability to introduce side effects arbitrarily with no warning to someone using your functions. To be fair I think the only relatively mainstream language that actually does something about this problem is Haskell with the IO monad (and to a much lesser extent Rust via unsafe). Just as Rust tackled the problems of concurrency through the language concept of ownership I think there's room to tackle side effects at the language level as well. Haskell does it one way, but there're potentially other approaches that could achieve the same goals in a hopefully slightly more approachable manner (insert monads are a endofunctor in the category of copypasta here).
Related to the idea of no side effects I think it's also really important to call out the concept of total functions, something it's incredibly hard to reason about in most languages but that's trivial in Haskell and not totally horrendous in Rust.
At the end of the day Lisps are atoms and lists and that's it
Plenty of objects in Haskell are not pure functions; examples include CAFs and IO actions. Haskell is referentially transparent, not pure. It's an acceptable language, but the community's memes are often incorrect or misleading.
There are statically typed Lisps. Even the simplest Lisp has more detail in its type system than you've sketched. Also, Lisps don't have flat set-like collections; they operate on trees. For more detail, refresh your knowledge about the functional paradigm with the corresponding WP or esolangs description.
Gleam seems awesome. However, Scheme/lisp are favorites of mine, so maybe Clojerl?
But if you really want to try out the latest and greatest in functional programming/languages I would suggest Idris2. I believe there is a BEAM back end as well.
Why the interest in BEAM?
Simple to learn language and focused on the main fp things (immutability, recursion, etc) gleam is good enough.
Otherwise on another ecosystem I'd recommend to check out standard ml.
middle ground point: start with the clj dialect for the ecosystem you're most familiar with. cljs for js, clj for jvm, etc. then you're learning the new language stuff but don't have to worry about a new ecosystem.
Haskell is the GOAT
If it weren't for the fact it doesn't have good library support for certain areas, e.g. GUI and graphical apps, I would use it for all my projects instead of C/Rust/Python/etc that I normally use
It's also good for learning bc it drops you in deep. Everything is a pure function and theory based. You will gain a lot of understanding. I also recommend trying to develop point-free notation in Haskell to further your functional knowledge
EDIT: Also, I would personally recommend against LISP (and its derivatives like Scheme and Closure), not bc they're bad languages - they're awesome - but bc they are overly simple in their premise. In LISP, there are basically "things" and "collections of things," and that's it. To me, it's not necessarily even functional, but its own paradigm.
EDIT 2: Also, check out code_report on YouTube. He talks a lot about functional languages (tho he talks even more about array languages lol). Check out the haskell solution on this video
I'd say go straight into Erlang if you're interested in BEAM.
- https://learnyousomeerlang.com/ - Probably the best introductory material to Erlang.
- https://github.com/happi/theBeamBook - The best book to read related BEAM.
Counterpoint: jumping right into lisp or haskell can be useful to get an idea of the paradigm too. Some concepts are so foreign it's almost better to be farther from the imperative or procedural stuff sometimes.
Scheme.
Start with a language that you do know that has functional features.
Javascript is actually an accessible intro to some concepts and applications.
Then once you have cut you teeth, find the true languages.
Other accessible alternatives: scala and clojure on top of java/jvm.
In my experience, I never really "got" functional programming until I had done the above.