Why did Facebook pick OCaml?
Facebook developed Flow, Hack, Infer, Pfff, and Reason using OCaml. And 50 % of the web version of Facebook Messenger has converted to Reason which lets you write simple, fast and quality type safe code while leveraging both the JavaScript & OCaml.
Due to the functional behaviour of OCaml, it helps to quickly adapt changing market conditions and go from prototypes to production systems with less effort.
The biggest reason behind facebook use OCaml is, it has support for defining own datatypes and the pattern matching on them.
OCaml is a functional language, with great support for first-class functions and immutable data structures. Similarly to the above, when you’re doing type checking, you end up doing a lot of different kinds of maps and folds over Abstract syntax tree nodes, and functional languages express that really concisely.
Hack
Hack is a compiler for a variant of PHP that aims to reconcile the fast development cycle of PHP with the discipline provided by static typing.
Flow
Flow is a similar to Hack that provides static type checking for Javascript. Flow improves productivity by making you code faster, smarter. Both systems are highly responsive, use the same model for multithreading that can incorporate source code changes in real-time.
Infer
Infer is another static code analysis tool developed by Facebook along with open-source contributors. Infer used to check for null pointer exceptions, resource leaks, annotation reachability, missing lock guards, and concurrency race conditions in Android and Java code. This helps to identify critical bugs before product released to the production environment and help to identify crashes or poor performance.
Piff
Pfff is a tool for APIs, to perform static analysis, code visualizations, code navigations, or style-preserving source-to-source transformations such as refactorings on source code. Piff used for C, Java, Javascript and PHP.
Reason
Reason is also known as ReasonML. It is a syntax extension and toolchain for OCaml. Reason offers a syntax familiar to JavaScript programmers.