A starting point for learning OCaml - a functional, type-safe, expressive, and battle-proven language
OCaml is an open-source functional, statically typed, and mature language. If you want to learn such a paradigm, OCaml is far more beginner-friendly than Haskell.
OCaml has a blazingly fast compiler and excellent type inference. It offers exhaustive pattern-matching, which makes your programs concise and a joy to work with.
But as ReasonML is OCaml, you should know how OCaml works.
This guide is for people who already know at least one programming language, not for total beginners.
Beginner’s Guide to OCaml Books⌗
Start by reading the blog post by Alex Clemmer. It provides an overview of novice-friendly books and tools.
The official website has a dedicated section for learning resources.
Cornell’s Book for Course 3110 (Learning a Language)⌗
(edit: Michael Kohl pointed this one out to me.)
The free text book covers a variety of topics concerning functional programming, and OCaml.
A Practical Approach⌗
To get started quickly, read the OCaml section of Learn X in Y minutes to get the big picture.
Supplement your learnings by reading the books mentioned above or by going through the free MOOC Introduction to Functional Programming in OCaml.
OCaml uses Opam for package management. You have to install it and then run the following command from your terminal:
Make sure to use a compatible OCaml version. The latest Ocaml version (4.09.0) doesn’t work yet; you have to downgrade to 4.07.0.
I’ve found a guide for VS Code and Ocaml from 2018, which could be useful.
If you use Vim, Merlin provides a better experience.
I’ll write a guide about my setup with NeoVim soon.