I remember learning to use OCaml in a properly functional way after so long writing code in C and it was really miserably painful trying to change how I thought about algorithms. I eventually got over the hill and it changed how I write code in C (for the better?), but I do wonder if it would have been easier to have learned OCaml as a first language instead.
I went through a book similar to the one above, with no internet connection. The first few weeks were rough: I did not quite know what a type was and the compiler error messages were unforgiving and hard to understand without that context. But, once I grokked the core ideas (a proper idea of what could be done with recursion took much longer), things went surprisingly smooth. I definitely credit it with making me a better programmer.
Also OCaml lets you write imperative code if you wish so. So you can learn the different paradigms within the same language.
I'm aware of why Haskell is not practical as a production language for most companies, but I have to say I've never really coded in anything else that feels as "neat" and it's a shame. Every other language feels like it has some idiosyncratic scaffolding one has to learn, reminding you that you're constrained by how computer hardware works, rather than just expressing an algorithm in terms of inputs and outputs.
I would say it has made me a better coder, I've still kept a preference for keeping data immutable, copyable and abstracting complexity into easily testable functions over classes with unobservable mutable state.
Lately, I keep asking myself, do I need to learn this new thing, should I force myself to learn this thing, LLMs know it anyways and so on.
So (asking genuinely), should we learn these things?
[1] https://www.cs.cornell.edu/courses/cs3110/2025sp/
[2] https://pragprog.com/titles/tpp20/the-pragmatic-programmer-2...
That being said, you may as well use Rust. The extra complexity of manual memory management and Rust idiosyncracies are easily dealt with by the LLM.
The answer is still the same as well, people learn ocaml either because they enjoy it, or because learning a functional language makes them a better programmer overall and teaches your brain to approach a problem in a different way.
More recently, you had to go to the store and buy it, which meant you didn't have much variety.
Today, learning an instrument is for social status, inheriting the shine of the past, where music was rare and costly. The reason to learn an instrument today is because the former situation was romanticized.
It'll probably take a generation before people ease into guilt-free enjoying infinite, fully generated music.
An oblique explanation: https://croissanthology.com/earring
But what about the future generations skipping the step of learning the OCaml's, the C's, the Python's...? It's quite concerning.
Oh by the way, yes. Learn OCaml!
Hhhmmmmm
[comment dead]
[comment deleted]
* Other “pure” hindley-milner languages are tied but among them ocaml has some particular strengths that I’m sure others will discuss.
(I have my own answers, but I'd love to hear yours, too.)
2. OCaml has an idiomatic approach of using interface files for all modules that can be accessed outside their libraries, and interface files give LLMs a great précis of exactly what is wanted. They then just have to follow the types and fill in the blanks to get the implementation. It's nearly the perfect use case.
Rust is fine if you need it but most things don’t and ocaml has more convenient abstractions for “regular” work. If you need rust you need rust but ocaml isn’t that far off in perf.
Haskell type system is too expressive, it itself becomes a place for the agent to make mistakes and get bogged down.
(2) performance
[1] https://www.youtube.com/watch?v=9Cswiqrq6So