OCaml vs Haskell learning resources

It’s insane how much more resources and books exists in Haskell compared to OCaml. Why’s that, and how can this change? (and should it change?)

Q: Why does Haskell have more learning resources than OCaml?
A: Because Haskell has more users, and also perhaps because it is seen as more useful for teaching functional programming, due to being purely functional. We may also observe in this context that functional programming advocates uncomfortable with the presence of classical OO features in OCaml, whether or not this sentiment is sensible.

Q: How can this change?
A: By creating more learning materials for OCaml. I guess this is obvious. It seems like there is a bit of an uptick in OCaml’s popularity at the moment and learning materials are actually being produced, but there is of course a bit of a chicken-egg problem. You get more users by having good learning materials and you get good learning materials by having more experienced users and a market of new users who want them. Still, we might attract more users by improving the platform experience in other ways. It’s a bit too late to remove the dreaded OO features which appear to drive away people interested in functional programming, but things like multicore and efforts to better support the platform for Windows may have a positive impact. The addition of an effects system will probably make the language more interesting to those coming more from the academic side as well.

Another problem here is that, for whatever reason, there’s not much of a culture for documentation in the OCaml community. You need a literate usership to produce learning materials, and a perusal of OCaml projects on github will reveal that the average OCaml library author is capable of producing code, but not written language. Perhaps there should be more investment in teaching OCaml programmers to read and write?

Q: Should it change?
A: We have multiple good sources that can help users get started with OCaml and become productive. RWO, the Cornell book and the ocaml.org new website are all fine ways to learn OCaml. I’m not sure more general learning materials are needed. A language needs good learning resources, not many learning resources.

What may be lacking are resources for learning how to do specific tasks in OCaml, and I believe this again comes back to the lack of documentation for 3rd party libraries.

example: How do I parse XML in X programming language? Find a library and read the documentation for examples and tutorials. How do I parse XML in OCaml? Find a library and look at the type signatures until you figure out how the author may have intended for it to be used. Forget about examples or docstrings which would tell you anything more than you could glean from the type signature.

So, in my opinion, the general learning resources for OCaml are already of high quality and we don’t necessarily need more (though more would be fine, too), but what should change is the culture around documentation, so the average OCaml library author will feel inclined to explain how to use their libraries to other programmers.

3 Likes