Guarded methods in OCaml
Summary
The article explains guarded methods in OCaml and how to encode them using a type equality witness (eq). It provides concrete OCaml code examples for implementing guarded methods like flatten and sum in a list-like object, demonstrating how type constraints are enforced at the method level. It also discusses similarities to Scala and the practicality of this encoding in a statically typed FP/OOP context.