News for hackers. Stuff that matters.
Re:Functional Programming in OCaml by e12e on Sunday March 03, 2019 @07:44AM (#19294193)
> 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?

Re:Functional Programming in OCaml by momentoftop on Monday March 04, 2019 @04:56AM (#19300049)
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.

Re:Functional Programming in OCaml by lenticular on Sunday March 03, 2019 @09:53AM (#19294689)
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.
Re:Functional Programming in OCaml by thedufer on Sunday March 03, 2019 @11:00AM (#19295056)
The ppx extension in question is called let-syntax, but also 4.08 is almost here and has built-in support for something similar.