Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

If you already know Haskell, how useful is it to look at OCaml?


There are some features in OCaml that are interesting if you're coming from a Haskell background. In particular, polymorphic variants don't have an obvious analog in Haskell and can be used very expressively. Certain problems can be reasoned about more easily (at least for me) with strict evaluation, so some problems are easier to deal with/debug in OCaml.


it's a fairly different language. Haskell is lazy by default, Ocaml isn't. The Haskell type system makes use of side-effects explicit, and Ocaml does not. They're only similar in the sense that they're both functional languages.

Ocaml's module system is definitely worth looking at especially in contrast to Haskell's typeclass approach if you want to compare both languages.


It might be quite useful to look at BER MetaOCaml[1] at least. And maybe at some other ways to deal with some problems - like OCaml DSL instead of Haskell monad[2].

[1] http://okmij.org/ftp/ML/MetaOCaml.html

[2] http://okmij.org/ftp/tagless-final/nondet-effect.html


A nice MetaOCaml example: https://strymonas.github.io/




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: