Hacker News new | past | comments | ask | show | jobs | submit login

> I also miss strongly some of the major Haskell conveniences like (...) Monads.

Could you elaborate? Ocaml has monads? Do you mean convenient do-notation for monads, or something else?




Monads in Haskell are an entire ecosystem, including wonderful things like Traversable and MTL style typeclasses, and I would need to see these ported before I could be convinced that Ocaml has monads (as anything more than a limited toy). I've tried to do extensive ports in the past, but given up, last time because I hit limits on Ocaml's ability to define mutually recursive functors.

In general, I've found programming with monads in Ocaml far less pleasant than Haskell, owing to the lack of overloading. The module implementation of monads requires you to functorise your code and apply a functor for every monad you want, while in Haskell I just (>>=) and the type system figures out what I meant. The verbosity makes me want to avoid them entirely.

The only other popular functional programming language I've seen which has a proper zoo of monads is Scala, which, I think by no coincidence, supports implicits and supports higher-kinding without having to functorise.


You can define monads in OCaml just fine using the module system, but there's no do-notation. I think there is a PPX extension to give that, though.


The ppx extension in question is called let-syntax, but also 4.08 is almost here and has built-in support for something similar.




Join us for AI Startup School this June 16-17 in San Francisco!

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

Search: