We chose OCaml to write Stategraph
15 days ago
- #Terraform
- #OCaml
- #TypeSafety
- Stategraph uses OCaml for its strong type system to prevent state corruption in concurrent operations.
- OCaml's type system catches bugs at compile time, such as incorrect field access or missing null checks.
- Immutability and database-level locking in Stategraph prevent race conditions and ensure data integrity.
- Typed SQL in Stategraph ensures database schema changes are caught at compile time, not in production.
- OCaml's PPX feature automatically generates correct JSON serialization code, eliminating manual testing for data loss.
- Error handling in Stategraph is exhaustive, with the compiler enforcing all error cases are handled.
- OCaml's immutability by default prevents accidental mutable state sharing between concurrent operations.
- Stategraph's design ensures Terraform state transformations are correct by construction, not by testing.
- Production systems like Jane Street use OCaml for its reliability and correctness guarantees.
- OCaml's learning curve is manageable for engineers familiar with type systems and distributed systems.