Choose clarity and simplicity over clever or complex constructs. Avoid unnecessary abstractions, complex function compositions, and “clever” code patterns that sacrifice readability for brevity.
Key principles:
Option.map (Fun.const true)
List.exists
for boolean checks, String.starts_with
over manual substring comparison)Example:
(* Avoid: clever but hard to read *)
code_config = Option.map (Fun.const true) code_config
(* Prefer: explicit and clear *)
match code_config with
| None -> false
| Some _ -> true
(* Or even simpler *)
Option.is_some code_config
The goal is code that any team member can quickly understand and modify. When choosing between a clever one-liner and a few clear lines, prefer clarity. This improves maintainability and reduces the cognitive load for future developers working with the code.
Enter the URL of a public GitHub repository