ocaml

Installation
SKILL.md

OCaml

OCaml is a statically-typed, mostly-functional language with a strong type inference engine (Hindley-Milner). Coming from JS/TS/PHP, the biggest mental shift is not syntax — it's that the compiler is a design partner, not a linter: exhaustive pattern matching and a sound type system catch entire classes of bugs (null checks, missed cases) at compile time that you're used to catching at runtime or not at all.

Default to explaining why something is idiomatic, not just that it is — the user is learning the language, not just translating syntax.

Type inference: don't annotate unless asked

OCaml infers types almost always correctly. Unless the user asks for annotations (or a .mli requires them), write bindings and functions without type annotations, e.g. let total_ttc price_ht tax_rate = price_ht *. (1. +. tax_rate). To see inferred types, use ocamlc -i file.ml, dune utop, or the toplevel. When reading an inference error, walk the constraints in order: the reported error is the last unsatisfiable constraint, not necessarily the mistake site. Examples and the full method: type inference and compiler errors.

Core language essentials

Installs
62
Repository
bsene/skills
GitHub Stars
7
First Seen
Aug 15, 2026