Functional and immutable by default ‣ Solid type system: structural, inferred and sound ‣ Flow is written in OCaml! ‣ Ecosystem & tooling ‣ ocaml-language-server
Generates fast code ‣ The language of React ‣ When Reason's creator created React, the prototype was written in Standard ML1 ‣ ReasonReact: All your ReactJS knowledge, codified ‣ Fun 1 OCaml is also a member of the ML programming language family.
matching ‣ 犖胼አ㬵玟獤㻌֖2 e.g.: Pt(2.)牏Px(12.) 2 Mars Climate Orbiter, costed hundreds of millions of US dollars, crashed because of a pound-force-seconds and newton-seconds type mismatch in 1999.
list of <something> and returns a <something>. *) let first: 'a list -> 'a = fun (item::_) -> item let second: 'a list -> 'a = fun (_::item::_) -> item (* * The type of function that takes a list of string and returns a string. * Note that this type signature is different from the two functions above. *) type listOfStringSelector = string list -> string (* A function that applies a listOfStringSelector to a list of string. *) let selectListOfStringBy: listOfStringSelector -> string list -> string = fun f -> fun l -> f l
'a = fun (_::item::_) -> item type listOfStringSelector = string list -> string let selectListOfStringBy: listOfStringSelector -> string list -> string = fun f -> fun l -> f l (* * The structure of * "function that takes a list of <something> and returns a <something>" * is comaticatible with * "function that takes a list of string and returns a string ", * so the code compiles! *) let b = ["a"; "b"; "c"; "d"] |> selectListOfStringBy second
OCaml will infer them correctly. (* * OCaml will know that the type of these functions are "'a list -> 'a", * as the argument is patteren-matched as a list and will return an * item from the list. *) let first = fun (item::_) -> item let second = fun (_::item::_) -> item