In OCaml from the Very Beginning John Whitington takes a no-prerequisites approach to teaching a modern general-purpose programming language. Each small, self-contained chapter introduces a new topic, building until the reader can write quite substantial programs. There are plenty of questions and, crucially, worked answers and hints. OCaml from the Very Beginning will appeal both to new programmers, and experienced programmers eager to explore functional languages such as OCaml. It is suitable both for formal use within an undergraduate or graduate curriculum, and for the interested amateur.
After reading OCaml From The Very Beginning my stance softened. Learning PURE OCaml is a must. (if you want to do AoC with it). You may find yourself bringing in Core or Base, after you've got a good idea of a solution.
It's definitely a fun language for doing AoC... but it can become extraordinarily frustrating when you hit a wall and all the StackOverflow answers assume Core.
I took a similar path years ago and I found your situation akin to mine. The documentation is spotty, full of gaps, particularly for a new comer; although I found some reasonable books that helped "OCaml from the very beginning, 2013" and "Real world OCaml 2nd edition, 2022".
I love OCaml but I don't see myself going back to it. I love re-reading old code that has been cleaned up. It reads like perfect design. It's satisfying.
However I found writing OCaml to be painful, battling the syntax and the LSP. The LSP being actively highlighting everything red due to one typo, because the syntax is this way, and it's frustrating... And sure, you can work without LSP support, but it's useful than cmd+tabbing 300 times to run the program and watch it crash on typos. The right balance is to turn it off and turn it back on at times.
But once finished, and years down the line, re-reading completed OCaml projects is a joy. I'd like to imagine that it made me a better programmer in other languages; due to the type-system-first approach, and transformation of data through functional programming.
I surveyed many free and paid-for references to build my foundation, before picking John Whitington's "Haskell From the Very Beginning" (https://www.haskellfromtheverybeginning.com), because it "takes a no-prerequisites approach to teaching the basics of a modern general-purpose programming language".
I am also using Replit's "free-tier" as my Haskell learning environment. Replit let me jump right into the fun of Haskell, while postponing dealing with installation/configuration nuances until absolutely necessary. This is also letting me do learning any time I have a free moment from wherever I last left off on any computing device I have handy, including my tablets or smartphone.
So far, my learning experience has been a joy.
If you decide on OCaml, Whitington also wrote "OCaml From the Very Beginning" (http://ocaml-book.com), which available via free pdf or HTML thanks to the OCaml Software Foundation, and looks to be structured similar to his Haskell book.
Hope this helps.
The textbooks are "OCaml from the very beginning" and "More OCaml: Algorithms, Methods & Diversions"
* OCaml from the very beginning: http://ocaml-book.com/
* Real World OCaml (shameless plug: author). Freely available online: https://realworldocaml.org
* The OCaml.org website itself: http://ocaml.org/learn/ (99 problems is really fun).
Mirage does of course offer an FFI to interface with C libraries, although the majority of the hacking efforts are geared towards filling in gaps in the pure OCaml library ecosystem. See the FFI blog post for more on this (you can even bind to C libraries interactively using the `utop` REPL with ctypes): http://openmirage.org/blog/modular-foreign-function-bindings
Mirage is as much about the security and efficiency of using static typing through the OS stack, as it is about exploring the concept of unikernels. There are other efforts more into compatibility with existing applications (like OSv) that you might want to look into for running an existing stack. But I encourage you to experiment with thinking and trying the Mirage style of unikernel assembly, and report back with where it works and the areas where it could improve!
Others have written more eloquently than me about why you should bother learning OCaml:
* Esper: http://tech.esper.com/2014/07/15/why-we-use-ocaml/
* Thomas Leonard's Python to OCaml retrospective: http://roscidus.com/blog/blog/2014/06/06/python-to-ocaml-ret... (Thomas also leads the Mirage ARM port work)
* Yaron Minsky's OCaml for the Masses: http://queue.acm.org/detail.cfm?id=2038036