Can I still write in OCaml?

I remember bucklescript originally was a compiler from ocaml to js, and now, as far as I know, it’s not even mentioned in the docs or anywhere else that rescript has to do anything with ocaml and its ecosystem at all.
I know that I can create an .ml file and compiler will pick it, thankfully, so support for ocaml is still there.
Although I can’t even find working plugin for vscode (all that I’ve used just for ocaml do not work in rescript project), anyway, one issue I’m concerned about in particular - is how do I define and call external uncurried function? Is it possilbe with OCaml?
Thank you!

And sorry if question is stupid and I don’t get something very simple, I’m just new to ocaml and prefer its concise syntax over rescript’s js-like syntax. I use rescript for jsx

1 Like

The older syntaxes are hidden on the docs site behind version < 8.2.0.

Using uncurried externals in ML syntax works like this:

type timerId
external setTimeout: ((unit -> unit) [@bs]) -> int -> timerId = "setTimeout" [@@bs.val]

let id = setTimeout ((fun () -> Js.log "hello") [@bs]) 1000


Also someone cloned the old BuckleScript docs and hosts it here (although the search redirects to the ReScript docs).

Furthermore, as the other syntaxes are no first-class citizens in the ReScript project anymore, Melange has been created as an alternative for OCaml developers who are used to ML or Reason syntax and the dune build system. They also try to set up their own docs site.


Wow, thank you! Very useful links! Love Melange!

1 Like