What are the biggest reasons newcomers give up on OCaml?

This looks fantastic @jonludlam!

Have you considered integrating a doctest-like feature (aka “testable examples”) into odoc?

If documenting could be merged into one’s (basic) testing workflow, I’m sure it would encourage even more adoption and usage.

Here are a few implementations of what I’m talking about:

This feature/concept is integrated into the default Go, Rust and Elixir tool chains (not sure about Python which is were the idea came from years ago).

The doctest feature for Haskell is supported by the default vscode tooling and easily integrated into a cabal workflow. It’s very nice to use, and looks like this:

This comment turns into executable code:
image

From the caller’s perspective:
image

This is what happens if I change my function input and click “Refresh” (the feedback is instantaneous).
image

Or clear the line and let the tooling auto-fill the output by clicking on “Evaluate”, similar to a dune promote workflow.
image

2 Likes