Pain Points of Ocaml
Key topics
The article discusses perceived pain points of OCaml, sparking a debate among commenters about the language's strengths and weaknesses, with some defending its design choices and others pointing out practical concerns.
Snapshot generated from the HN discussion
Discussion Activity
Very active discussionFirst comment
3h
Peak period
36
6-12h
Avg / period
8.9
Based on 80 loaded comments
Key moments
- 01Story posted
Nov 4, 2025 at 12:41 AM EST
about 2 months ago
Step 01 - 02First comment
Nov 4, 2025 at 3:20 AM EST
3h after posting
Step 02 - 03Peak activity
36 comments in 6-12h
Hottest window of the conversation
Step 03 - 04Latest activity
Nov 6, 2025 at 4:49 PM EST
about 2 months ago
Step 04
Generating AI Summary...
Analyzing up to 500 comments to identify key contributors and discussion patterns
Want the full context?
Jump to the original sources
Read the primary article or dive into the live Hacker News thread when you're ready.
The ecosystem stays out of the way as much as possible - we are mainly interested in interfacing with C code directly, and OCaml (and Rust) make that pretty easy. I've been writing this project for over a decade and the language has been reasonably stable (OCaml 5 made some changes to the C interface, but we coped). Rust actually causes far more code churn - there's virtually a monthly cycle of some Rust compiler update requiring changes to existing code.
This is really surprising to me. Which changes have you had to deal with here? The only one I can think of is the major Edition 2024 upgrade, which changed the `#[no_mangle]` attribute to `#[unsafe(no_mangle)]`. But the old syntax still compiles just fine with the newest compiler using Edition 2021.
The good thing is clippy / rustc has very good diagnostics and usually tells you "do X to fix this".
Or tie it to the current edition, or the current MSRV if defined.
There’s plenty of options to not have to deal with that (unless you want to of course).
Basically, when someone complaining starts by "I don't like the Algol-like syntax", obviously without saying it's Algol-like because that would require they actually know what Algol is, the rest is probably going to be extremely poor at best.
And here, it doesn't disappoint. Point 2, "I don't like type inference, it's too clever". Or you could just put type annotations at every declarations like every pieces of documentation ever produced on the language invite you to.
The type paragraph and the mentions of shadowing actually shows the author doesn't know how to use the Ocaml module system. For the neophytes here, it's the main standout feature of Ocaml. It's a bit like talking about C without knowing how to use pointers. I have seen people do that actually so I probably shouldn't be too surprised.
Menhir and ocamllex syntaxes are just slight twists on the actual syntaxes of yacc and lex. Nothing surprising for someone who knows both tools but I guess it's becoming a rarity nowadays. To be honest, the Ocaml compiler works exactly how you would expect a C compiler and linker to work. That makes it really simple and predictable for people who used to be C programmers but apparently completely inscrutable for young developers.
For printing, they quote "#[derive(Debug)]" in Rust but apparently they never reached ppx_deriving in Ocaml. It's a shame because it does exactly the same thing.
The whole conclusion with the weird segway about academics for a language which was purposefully designed to write provers and not as a research language doesn't even deserve to be commented upon.
Anyway, just go use Rust, bask in the hype, fight the borrow checker for things which don't require manual memory management, and leave us be. I think a significant part of why Ocaml is nice is that it is not appealing to many developers.
Thank you for your comment because I've been meaning to give OCaml a serious chance for a vary long time.
If you specifically want a strict language and explore the OCaml ecosystem (or you already know Haskell): have fun with OCaml!
I've used both extensively---in addition to Racket, Erlang, Clean, etc, and various imperative languages.
Onboarding can be complicated. I'm complaining about new comers not reading the documentation before writting articles but objectively some concepts are so foreign, it's a bit difficult to see what you are missing. Module level programming for exemple is key to writing good Ocaml and it's quite a step if you are entirely new to functional programming. Effects are great but conceptually it's quite hard to get your head around them. Some fairly common libraries use Haskell influenced monadic interface. Yet another hurdle.
Traits have their flaws but I have to agree that having to be explicit all the time can be annoying. Modular implicit would be nice.
Concurrency is soon to be a lot better now that the effect system is mostly there and eio is landing.
The standard library is in the best shape it has ever been. I would still like more.
I've used OCaml for writing small compilers and it was really clean but that's a toy thing that will not see much real world usage.
It's surprisingly nice for web development also when you compile to JS. The ecosystem around Mirage and microkernel is quite impressive and if you want to build low level things and I for one like it significantly more than Rust for CLI tools.
It's a very versatile language honestly. It's opinionated enough that you have a clear idea of what would be the community choice but not so much that you can't just go to town with a different solution if it suits how you want to approach the problem more even it is an imperative implementation or even something object oriented.
I personally view Ocaml as basically a better Python with more features, better performance but without the huge success.
It seems like you need to either be purely functional or have a borrowchecker if you want to have "fearless concurrency".
The learning process for me has been as follows:
1. Make an error somewhere, maybe due to a misunderstanding
2. Error message makes no sense, or I don't know enough OCaml
3. Re-read the relevant portion of the documentation and examples
4. Hope that I can find the right way to do this somewhere
Compare this to Rust, which treats us quite nicely with descriptive errors that complement a vast and comprehensive reference manual. I do RTFM but a programming language is too big to learn all at once by reading a book before starting programming.
> Basically, when someone complaining starts by "I don't like the Algol-like syntax", obviously without saying it's Algol-like because that would require they actually know what Algol is, the rest is probably going to be extremely poor at best.
I am vaguely familiar with ALGOL but have never used it before. Do I need to put down OCaml and learn ALGOL first in order for my syntax complaints to be well-justified?
> And here, it doesn't disappoint. Point 2, "I don't like type inference, it's too clever". Or you could just put type annotations at every declarations like every pieces of documentation ever produced on the language invite you to.
I am doing this now, as I stated in the article. Compare against Rust's strictness, where bad ideas like not annotating function signatures are not allowed.
> The type paragraph and the mentions of shadowing actually shows the author doesn't know how to use the Ocaml module system. For the neophytes here, it's the main standout feature of Ocaml. It's a bit like talking about C without knowing how to use pointers. I have seen people do that actually so I probably shouldn't be too surprised.
I said in the article that:
> Enumerated types also dump all of their variants into the module scope
Is it wrong to say that they dump their types into the module scope? You have to put enum types in separate modules otherwise they will step on each other. (Is this understanding incorrect?) Maybe I will come to appreciate this as I learn more OCaml, but right now it seems like an unnecessary footgun.
> Menhir and ocamllex syntaxes are just slight twists on the actual syntaxes of yacc and lex. Nothing surprising for someone who knows both tools but I guess it's becoming a rarity nowadays.
Yes, I know this. The part that I don't understand is why OCaml wants to be like C with these tools in the first place. These tools exist in C because C doesn't have match statements, but OCaml does. What gives?
> For printing, they quote "#[derive(Debug)]" in Rust but apparently they never reached ppx_deriving in Ocaml. It's a shame because it does exactly the same thing.
ppx_show is an external library. Imagine having such a cucked stdlib that you have to call to an external library to print
> I think a significant part of why Ocaml is nice is that it is not appealing to many developers.
Clearly, that’s why people made a better syntax frontend for OCaml
Your syntax complaints will never be well-justified. It’s just a syntax family you are unfamiliar with, not an actual downside. You can either put up with it or change language. The syntax is however in no way inferior to C style syntax because that’s what you are used to.
> I am doing this now, as I stated in the article. Compare against Rust's strictness, where bad ideas like not annotating function signatures are not allowed.
There is no point in forcing you. The language doesn’t need to be strict. You can do whatever you want with your type annotation. It works just fine when you do annotate but no one is putting a gun to your head to do so if you just need a quick script. Best of both worlds.
> You have to put enum types in separate modules otherwise they will step on each other.
You do but it’s entirely normal and expected to define a new module inside your file in Ocaml and "let open" or assigning module is a common construct. It’s expected that you will not dump everything directly in scope.
> The part that I don't understand is why OCaml wants to be like C with these tools in the first place. These tools exist in C because C doesn't have match statements, but OCaml does. What gives?
They exist because generating parsers and lexers are nice and no one wants to learn a new language when they already know yacc and lex.
> ppx_show is an external library. Imagine having such a cucked stdlib that you have to call to an external library to print
No need to be vulgar. Ocaml has a lean standard library. That’s how the language is. You want macro and derivations you import them. They exist. Everybody uses them. The comment is a bit rich coming from someone who likes Rust.
I think match statements should have an explicit `end` terminator or something so that you can nest them naturally. I think errors from accidental partial function application could be clearer. I think those two are pretty objective.
In terms of my subjective opinion the punctuation of C-style makes code hierarchy more clear, but at the cost of making it read less fluidly. I also think that `let...in` is weird and that Rust straddles a nice middle ground here by not having it but still having everything be an expression.
I like strict languages, and I like Rust for its strictness and robustness. I don’t like its standard library though, I wish it was more batteries included.
It’s unneeded.
You can explicitly delimit any expression in Ocaml by using begin … end or parentheses. It works for everything including match statements which are expressions. So you are already free to use an explicit end statement if you are so inclined.
Re: better syntax frontend for OCaml. People really tried to, for many years. But it didn't work, there was never much adoption. And the funny thing was that as soon as people got comfortable with it they switched to the standard OCaml syntax because they understood it better and started preferring it. Ironic!
Way to deflect any possible criticism x) I've used Ocaml for many years, and the syntax is undeniably a drag. There are inconsistencies, poor choices, none of which are a dealbreaker on their own but which together impose an ever-present friction. Death by a thousand cuts if you will. One of them explicitly mentioned in the article: the match statement.
> For printing, they quote "#[derive(Debug)]" in Rust but apparently they never reached ppx_deriving in Ocaml. It's a shame because it does exactly the same thing.
How do you print a list in OCaml? There's your answer as to why it's not the same thing.
There is no blame to defect. What’s supposed to be so weird about Ocaml syntax?
> How do you print a list in OCaml? There's your answer as to why it's not the same thing.
Don’t get your point.
You can ppx_derive on a list type. There is a feature specifically designed for this common use case. That gives you a pretty printer for a list. Alternatively you can tier the type pretty printer.
Is there supposed to be something special with lists?
For the most common cases, I agree. I always wondered why OCaml remained such a niche language, given that many of its nice features took decades to appear in more mainstream languages. I thought it was because the language was too complex and advanced for the mainstream audience. However, with the rise of Rust, I don't think so anymore. Rust is, in many ways, as complex as OCaml and, in certain cases, even more complicated. Yet, it's becoming very popular.
So my second theory about its lack of popularity must be correct: it has beginner-unfriendly documentation. In fact, I would even say it's unfriendly to engineers (as developers). The OCaml community prefers to see this language as an academic affair and doesn't see the need to attract the masses. Rust is an example of the opposite. It's a complex language, but it's pushing hard to become mainstream.
https://t3x.org/mlite/index.html
I like FP, so that was not a problem. But I found that lots of stuff was pretty hard for me as just an old guy trying to write some fancy little GUI apps to assist some of my other spare time activities. The project system, dune, was puzzling to me, and when I looked for clarification on-line it was pretty clear that I had lots of company. Not wanting to pass time writing code and seeing many potentialy useful packages available, I downloaded quite a few (actually, I downloaded not too many, but the dependencies required for those multiplied rapidly). Then I found myself managing multiple environments, because the different versions of this and that do not always work together so nice.
Some library code has to get imported some ways, some other ways. Etc, etc. Many tutorials teach the toplevel interpreter, but that's not recommended for projects of any size, and the other environments will choke on the code that works in the toplevel.
What I liked is that the OCaml ecosystem doen't look like it wants to control or ought to fear the next big thing. It's what you get when you have a lot of smart creative people who get inspired and do their best according to their own motivations and their own conception of quality. I admire that. I'm glad that I tried it.
The big downside is the paradigm shift + inscrutable error messages.
It will make you feel dumb and/or unproductive for a very long time.
A lot of the type errors can be fixed by a compiler that cares more about error messages, and OCaml in particular could do well with terminators after e.g. match blocks to improve both ambiguity and error reporting. Some of the type errors can't easily be fixed; wrong function application by omitting some value somewhere has, so far, always led to misleading errors; are there any other examples than Elm that address these?
I also switched from ML to Haskell to Rust.
To me, the main downside of ML is the explicitly instantiated module systems not tied to the filesystem hierarchy.
Once you get used to traits and parameterised trait instances, bringing every module instantiation into scope after separately importing them is just slooow.
The standard library situation is also somewhat not great. Maybe I just never got used to it, but I sense that there are people think Jane Street Base is a must, and people who think it's completely overkill. OCaml programmers have a weird fetish with micro-optimization because the compiler lets you think about the asm output. It's a remarkable property of an otherwise high-level language that you can really care about the asm output.
You can use either begin/end or parentheses as terminators around any blocks of Ocaml for exactly that purpose.
> To me, the main downside of ML is the explicitly instantiated module systems not tied to the filesystem hierarchy.
That's one of the greatest strenght of ML actually and especially Ocaml where parametrised modules are everywhere and a required building block of generic code. A significant part of why the article complains about type for exemple is because the author doesn't know how to use the module system.
> Once you get used to traits and parameterised trait instances
I like modules a lot more. It makes the code a lot clearer than traits.
> The standard library situation is also somewhat not great. Maybe I just never got used to it, but I sense that there are people think Jane Street Base is a must
The standard library is a lot more complete nowadays that it was some years ago and Base is used by pretty much nobody outside of JaneStreet.
There are devivers and a Format module for pretty printing.
https://github.com/ocaml-ppx/ppx_deriving
https://ocaml.org/manual/5.4/api/Format.html
[0] https://github.com/facet-rs/facet
Derivers are a library yes, it's pretty widespread if you need derive functionality, and it can derive basic functions. Proper link:
https://github.com/ocaml-ppx/ppx_deriving?tab=readme-ov-file...
What many other languages do that if you have an object, you can just transform that object into a string or output it with debug formatting, without any particular support from the object. It isn't much of a chore, but it is some; and polymorphic functions now need one extra argument for the formatter.
I do recall there's a module for OCaml that can do "debug level" printing of objects by traversing their runtime structure, but that of course doesn't suite all objects.
At least in Rust it's not automatic that you can print an object in the first place :).
OCaml's real pain point isn't the syntax - it's that you can't hire for it. if you're building a startup and you pick OCaml, you've just cut your hiring pool by 95%. that's way more painful than learning a different way to write functions.
the whole "academic vs practical" thing is backwards. academic languages often have killer features that would save you real pain, but if your team can't debug it or you can't find Stack Overflow answers at 2am, none of that matters. language choice is a business decision, not a technical purity contest.
I hear this a lot about Scala and it's never been an issue in practice.
A smaller pool of candidates makes hiring easier, I'd much rather screen 20 résumés than 400. The typical candidate, whether experienced or willing to learn, is also better on average.
"We can't find qualified developers" usually tells more about the employer, in reality that means:
- We aren't willing to pay market rates.
- We don't invest in even the most basic on-the-job training.
- Seniority distribution is junior heavy; we expect one senior developer per team who can mentor all the other ones.
Or a combination of the above.
I know two relatively small companies that use OCaml, they don't pay anywhere near Jane Street salaries, but they're willing to hire people who show interest in the language and invest a little in their training. This works. On my end I've hired several people coming almost purely from Python, after a few weeks they contribute to fairly advanced Scala codebases.
A week to learn syntax? Sure. But to really be a fully operational battle-station engineer in a new language stack is probably 6 months to a year.
I would however expect people to be able to submit code reviews for e.g. bug fixes and small features after two to three weeks.
If you are reasonably experienced with computers, learning the syntax will take you 2h. Again, that's Ocaml we are talking about. ML syntax has been designed to teach programming to fresh students with just a background in math.
If you already know C and Unix, you will be good to go in one afternoon... unless you want to use dune or compile to JS or use the repl etc.
C'mon, there's more there than 2 weeks.
What do you think their chances are?
There's a whole pool of people out there like myself who like to work in languages like this but don't because there's very few jobs in them.
When I heard people say they "can't hire for tech X" I usually find there's something else going on. I just left a job where they said they "couldn't hire" for Rust -- let me tell you... Finding Rust talent is not their problem. They have far more serious problems from which "retaining Rust talent" is a symptom.
The challenge with making good software is not language choice. It's communication and culture and making good foundational choices about software architecture that fit your problem domain. Writing code is the easy part, usually.
You can hire anyone who already understands pattern matching, closures, map/fold (these are more and more common constructs nowadays) and train them to learn OCaml. It's a simple language overall, especially if your codebase doesn't use any complicated features.
Dude, what?
But otherwise I don't particularly agree with OPs pain points. I personally find OCaml's syntax to be great. Very easy to write and read once you're used to it. And I previously thought that it's very important to annotate all types, as it would help with my thinking, but these days I find I'm more productive when I write out the code without types, maybe add a type here and there. I only annotate if OCaml's deduced type is too complex or generic.
If you don’t use ocamllex/Menhir, what do you use for parsing & compiling?
This kind of confusion instantly goes away when you use auto-formatting with ocamlformat, which is the recommended formatting tool for the OCaml platform. It would line up your match cases in such a way that you would be able to almost immediately tell that the compiler is interpreting the dangling cases as part of the inner match.
If so, that would be unfortunate... because the whole raison d'etre of ReasonML is DX! Specifically, to provide a more familiar syntax for programmers coming from the curly-brace world.
In F#
Is this the best they can do? C# just has Ive always wanted ML syntax like this: I just dont write a ton of pure functions which have no I/O dependencies[0]: https://github.com/demystifyfp/FsToolkit.ErrorHandling
[1]: https://learn.microsoft.com/en-us/dotnet/fsharp/language-ref...
The complaint about syntax is amusing, I get a bit annoyed when I see Rust syntax being inserted into Java/C-ish languages.
[0] http://adam.chlipala.net/mlcomp/
Also, isn't freedom of annotating a function a good thing, instead of having a requirement on it? You can just explicitly annotate some stuff when you have a type error that doesn't feel right!
OCaml is way more simple from the type system perspective than Rust, I think it makes it great when you need a lot of iteration on you code.
One thing I do agree on are problems with the ecosystem. Maybe not quite in the specific area described here but man we got some problems in IO/concurrency/asynchrony space. Making a GOOD standard for it would just improve all our lives as OCaml developers.
[1] https://github.com/ocaml-ppx/ppx_deriving