by mbac32768 · 1y ago · 0 comments
OCaml is immediate by default instead of lazy, and allows imperative code with side-effects. Both escape hatches from the pure FP world.
So, performance is easier to reason about and you can interact with your side-effecty real world stuff without having to reorganize your whole program around the correct monad.
Most of the time you want your loops to be higher order functions but once in awhile you want to just build a vector from a for loop. OCaml let's you do it without it being a whole intervention.
Laziness by default was definitely an opinionated design choice for a language when using it in production
anyway, it's a fairly trivial wrapper to handle the odd annoying thing that raises
Option.try_with (fun () -> thing_that_exns ())
Result.try_with (fun () -> thing_that_exns ())
(it would be nice if you could tell if something raises by the type signature somehow though)