
OCaml 4.08 - mseri
https://inbox.ocaml.org/caml-list/E2C57A5B-D770-426C-8DAF-514B6A369D2A@inria.fr/
======
TheAsprngHacker
This release adds "binding operators," which make functors, applicatives, and
monads more convenient to use. The "binding operators" are like OCaml's
version of Haskell's do-notation, but IMO even better. In Haskell's do-
notation, each binding in the form of `pat <\- expr; next` desugars to monadic
bind, with an extension to use applicatives instead where possible, but with
OCaml's binding operators, there are three separate operators for functors,
applicatives, and monads.

The 4.08.0 release also adds the Fun, Option, and Result modules to the
standard library.

~~~
KirinDave
What's better? Is the idea that there are 3 separate operators better, or did
the reason why not come through in the post?

~~~
TheAsprngHacker
I meant that there being three separate operators makes OCaml's design better
than Haskell's. (Of course, this is just my personal opinion.)

~~~
KirinDave
Well, the reason I'm confused is that Haskell has different binding operators
too. Applicatives can't use >>=.

~~~
TheAsprngHacker
I meant Haskell's do-notation sugar - it only works for monads (or
applicatives, assuming ApplicativeDo and absence of dependencies on
intermediate results). OCaml's new "binding operators" let you define your own
variations of `let` and `and`, which resemble do-notation and therefore have
the same cognitive convenience. Then, you can define `let` for functors, etc.
You can basically have `let` sugar for any operation that takes a function as
the second argument.

------
threwawasy1228
It doesn't get said very much but the ML ecosystem is full, complete, and very
much production quality. It is a shame that there are not many projects or
companies that make use of all that it has to offer.

~~~
Barrin92
I'm always surprised that F# didn't take off. It's a great language and in
addition to the strenghts of ML you have the .net ecosystem and Microsoft
behind it.

~~~
np_tedious
Jet uses F# almost exclusively

[https://github.com/jet](https://github.com/jet)

[https://link.medium.com/spjuV2aAwX](https://link.medium.com/spjuV2aAwX)

~~~
pjmlp
Jet might not exist for much longer.

[https://www.reuters.com/article/us-walmart-jet-com/jetcom-
fa...](https://www.reuters.com/article/us-walmart-jet-com/jetcom-falls-by-
wayside-as-walmart-focuses-on-its-website-online-grocery-idUSKCN1TD2PS)

------
andrepd
I'm not entirely convinced that the let operators were a good idea. What's
wrong with the ppx rewriter notation (let%bind = ...)? That's, after all, what
it's for: provide custom extensions to the language syntax.

Quality of life improvements in the standard library are maybe the biggest
deal for me (since I don't use any stdlib replacement like Batteries or Base).
Stuff like the Int, Bool, Option, etc. modules, or filter_map... It's mind
boggling how they've only been added now (but good thing they were).

------
amelius
This is great, but I'm still waiting for multicore support, and a mature GUI
library.

~~~
bsaul
I wonder how come people working in PL research aren’t more interested in
concurrency. Typeclass, monads, etcs are great but they still haven’t reach
the point were everyday people could expect to write proved safe program (
unless the code base is extremely small and you’re using special software such
as Coq), and while they make programs more concise and expressives, i think
concurrency remains the elephant in the room.

Rust is the first PL i’ve heard in a long time that tries to actually do
something in that area since erlang ( that opted for strict message passing
and let it crash philosophy, but gave you the tool to deal with that
approach).

Is it because it’s too « down to earth » for PL purist, or is it simply
because they don’t have the mathematical or logical tools to deal with the
problem ?

~~~
fulafel
Quite a lot of things have been tried since Erlang (1986). Concurrency has
been a fairly well funded sector of compiler and PL research to the point of
starving other arguably more important areas.

Wp has a list at
[https://en.m.wikipedia.org/wiki/List_of_concurrent_and_paral...](https://en.m.wikipedia.org/wiki/List_of_concurrent_and_parallel_programming_languages)

Futhark is one of the more interesting recent parallel languages IMO since GPU
languages were in such a lull for a while. Too bad everyone is stuck with
emitting opencl or going vendor specific though.

~~~
amelius
> Concurrency has been a fairly well funded sector of compiler and PL research
> to the point of starving other arguably more important areas.

Concurrency is enormously important in a world where instruction speed has
saturated. Many problems are highly data-coupled, so you can't just separate
these problems into loose tasks that you connect with a slow message pipe.

Of course, if you're just writing a web server or a chat server, then you
might be lucky and you can get away with it. But please don't assume this
holds for everybody.

~~~
fulafel
Yeah, but it's "just" speed of execution, while for most things the bottleneck
of making something possible is correctness and ease of developing while
keeping complexity in check. So yes it's important but still mostly less
important than some others :)

Tensorflow is interesting in this respect. Leveraging a lot of parallelism and
using a parallel pl under the good, while presenting itself as a dev friendly
Python lib on the surface.

------
willtim
I'm a Haskeller, but it's great to see OCaml improving significantly with
every release. It's a win for typed functional programming in general.

------
melling
“Many error messages were improved.”

A few months ago someone on HN mentioned that error messages would be greatly
improved in this release, which would make learning OCaml much easier.

Does anyone have more details on this?

~~~
octachron
There were a handful of concomitant improvements:

* The printing of error message has been improved to display the code source responsible of the error outside of the REPL.

* Some probable beginner errors (like discarding a non-applied function with `ignore`) now raises a warning.

* Type name captures should not happen anymore in error messages: no more `val x: int` is not included in `val x: int` where `int` refers silentiously to different types.

* A handful of typing errors has been fixed to speak to users and not the compiler developers (no more "unexpected existentials" for instance).

* Some compiler internal change to make it much easier to use the typing context when explaining a type error. This is not used much yet, but I hope to improve the scope related type errors in the next versions.

------
bitmadness
If they had Unicode support and multicore support in the language I'd be a lot
more interested.. hopefully in five or ten years we'll get there.

------
mlevental
anyone know a good ide for ocaml? something with tab complete and jump to
definition?

~~~
anuragsoni
While not a traditional IDE, Merlin [1] combined with vim/emacs/vscode is
really good (autocompletion, jump to definition, type lookup and more). Merlin
also gained support for language server protocol recently so that could be an
option for any editor/IDE that has a language server client.

[1] [https://github.com/ocaml/merlin.git](https://github.com/ocaml/merlin.git)

EDIT: I'd also like to point out OCamlformat ([https://github.com/ocaml-
ppx/ocamlformat](https://github.com/ocaml-ppx/ocamlformat)). It works really
well in my experience and makes it really easy to perform automatic code
formatting, and can be used in CI to check that changed conform to the
formatting style a project prefers.

~~~
xfer
Merlin is very good. Wish something like this was available for haskell.

------
jpittis
Does anyone have any links to examples or docs for how the “binding operators”
work?

~~~
octachron
There is a dry technical description at [http://caml.inria.fr/pub/docs/manual-
ocaml-4.08/manual046.ht...](http://caml.inria.fr/pub/docs/manual-
ocaml-4.08/manual046.html) . And a more illustrative description at
[https://jobjo.github.io/2019/04/24/ocaml-has-some-new-
shiny-...](https://jobjo.github.io/2019/04/24/ocaml-has-some-new-shiny-
syntax.html) .

------
asplake
Getting a 404 here: You can find more details at
[https://ocaml.org/releases/4.08.0.html](https://ocaml.org/releases/4.08.0.html)

~~~
ddebernardy
That's a 404 for me as well. This works:

[https://github.com/damiendoligez/ocaml.org/blob/add-
release-...](https://github.com/damiendoligez/ocaml.org/blob/add-
release-4.08.0/site/releases/4.08.0.md)

~~~
asplake
Thanks

