DEV Community

Discussion on: Getting your feet wet with OCaml

Collapse
 
bobbypriambodo profile image
Bobby Priambodo

Hi Jan, thank you for your opinion. It's great that Haskell works for you.

Your critiques are indeed valid. On the typeclasses story, there are works on modular implicits that aim to solve that (your exact concerns are stated on the introduction of the paper).

I see OCaml as a friendlier introduction to FP; if you're uncomfortable with diving deep to FP, there are escape hatches available to use imperative constructs. Indeed that sacrifices the security you get like with Haskell, but then again everything is a trade-off. Reason shows that you can even incorporate a JS-ish syntax for it to fix many of the warts, which I guess is interesting to some demography of developers.

Haskell is a great language, and I'm sure Haskell programs are fast, but the development experience for me is slower than OCaml. The compilation takes a long time, ghc-mod is slow to query types, Intero is better but still nowhere near Merlin in my opinion. Compilation in OCaml is fast, either you compile to native, bytecode, or JS (with BuckleScript or js_of_ocaml).

No straightforward way to annotate type signatures is also one of the bad sides, it prevents type-driven development like what you can do with Haskell. But with how fast Merlin is and how good the type inference is, it doesn't feel that much limiting for me.

But that said, I still think both Haskell and OCaml are on the top of my favorite languages list, so... :)