A next-generation IDE for OCaml

We would love to have as much of the dynamism of Smalltalk as possible. Not only coding in the debugger, but also coding together with the AI in the debugger! And at the same time to have more coding assistance from type inference and autocompletion.
Could you share your use case with us? We’re collecting evidence that people would be interested in such a product.

Thanks Yawar!
Could you please share more details on why you and your company might be interested in such an AI-powered IDE?

This sounds really exciting! Coincidentally, I have actually just started evaluating CLion for embedded development at work :smile:. I don’t really know what kind of pricing model there is yet but if I could get the OCaml one as well I would be really keen to try it out.

Here are some things I would like, but am not sure how feasible they are

  • A solid debugging experience (I know solutions exist for ocaml but I’ve just never found them as easy as I’d like)
  • Generating mli or type signatures from implementation code. I prefer to prototype in .ml and not get bogged down in module interfaces etc but they’re great for readability by others.
  • Robust collaboration features and easy setup. Getting someone to install the IDE should be all they need to open a project and execute it

Here are a few more ambitious happy thought that are just off the cuff:

  • Code generation tools based on OCaml. We all know that OCaml is great for DSLs, compilers, pattern matching on syntax trees etc, it would be awesome if we could write IDLs and generate either types, or, even better, FFI code in a number of languages
  • (preface: I’m not all that into the webdev scene but I recognise how useful it is in general) WASM compilation with easy setup and JS interface generation (this might already exist, Im not sure)
  • UI helpers for developing PPXs
  • I think even an amazing project would be hamstrung by the niche-ness of OCaml, but if you pitch it with Reason syntax it would be easier to sell people not familiar with OCaml on
  • More specifically about AI, it should be able to take in your project as context like GitHub’s one so as to generate more accurate responses & code
  • Some sort of hierarchical state machine library that you could talk to an AI to describe as a specification, along with generated mermaid diagrams (Claude does this) that then can output accurate OCaml code that fits the specification
  • The same as above but with SQL schemas and auto generating the query code
  • Even crazier idea, something resembling an abstract representation of modern development that you could then codegen in multiple languages depending on the need. this would be killer for developing an API spec and then generating SDKs in multiple languages
  • An easily embeddable runtime that works on mobile. I want to do some things in React Native that aren’t supported by its js runtime (you cant use gRPC?) and the native module story is painful. I dont know if this is possible but some sort of embeddable runtime that can access system calls that just “runs anywhere” ?

I think this is great idea. You should probably look into the ocsigen project which is a futuristic web framework for OCaml. It allows you to have typed communication between client and server. You can get an ocaml value from the backend into the frontend with a simple function call, the serialization and deserialization and building the request and answering it is done for you.
The current editor tooling does not work 100% with it, but of course this would not be an issue if you build a new editor.
I think that if communicated on properly, a web framework like ocsigen could really drive adoption.

5 Likes

Hello. I was just curious to know what features you think Merlin could improve in to make it better?

1 Like

I haven’t checked, but I think the current implementation of Emacs’ handling of OCaml uses ocp for indentation, and the harmony with merlin is not perfect in that regard.

The immediate practical problem is actually more about the ability to run expressions in utop. I currently don’t see a way to do this nicely from emacs, and have to do dune utop, and copy-paste some expressions in a separate terminal window. That’s annoying.

I would like emacs to switch between different workspaces more naturally, especially if there’re a lot of similarly named files. I have configured buffer switching mode to the death, and still have to spend a few seconds sometimes to switch between files I really mean to switch to.

I would like to visualize somehow the hierarchy of modules, dependencies, etc. I don’t mind a separate graphical window, even from another program, but sensitive to my current editing context. I don’t think emacs has display capabilities for that.

I think that by itself merlin is great — since its exact niche was located and it fits more or less perfectly within that niche. The tooling should be about augmenting the editing context, by adding other parallel processes. Trying to squeeze those into merlin itself would be bloat.

Yes. ReasonML. Full stack development. Thank you.