[Docs] Document the OCaml support

This commit is contained in:
Bozhidar Batsov 2022-06-14 08:56:42 +03:00
parent aba9fb71c6
commit 1ff2230d8d
2 changed files with 50 additions and 1 deletions

View file

@ -92,7 +92,7 @@ The following programming languages have enhanced support in Prelude:
- [Lisp Base](modules/lisp.md) (common foundation for Lisp modules) - [Lisp Base](modules/lisp.md) (common foundation for Lisp modules)
- Lua - Lua
- Markdown - Markdown
- OCaml - [OCaml](modules/ocaml.md)
- Org Mode - Org Mode
- Perl - Perl
- [Python](modules/python.md) - [Python](modules/python.md)

49
docs/modules/ocaml.md Normal file
View file

@ -0,0 +1,49 @@
# Prelude OCaml
!!! Note
This module builds on top of the shared [Programming](programming.md) module.
## Overview
Prelude provides powerful out-of-the-box experience for programming in OCaml:
- major-mode for editing OCaml code (`tuareg-mode`)
- integration with `utop`, OCaml's modern top-level (you can think of it as a REPL)
- linting via `flycheck` or `merlin`
- code completion via `merlin`
You can get similar experience using OCaml's LSP server, but it's based on Merlin internally and the setup with LSP is a bit more involved.
## Packages
When the `prelude-ocaml` is enabled it will install 3 packages:
- `tuareg-mode`
- `utop`
- `merlin`
## Environment Setup
These setups for ocaml assume that you are using the OPAM package
manager (http://opam.ocaml.org/).
Because of the apparent complexity of getting Emacs environment
variables setup to use opam correctly, it is instead easier to use
opam itself to execute any necessary commands.
Also, the standard OCaml toplevel usage has been replaced in favor
of UTOP, the universal toplevel, and we assume that you are using
the Jane Street Core libraries rather than the regular OCaml
standard libraries
The minimum required setup for using Prelude's OCaml setup would be
to install OPAM, and then, minimally `opam install core utop'. A
good getting started guide is available at
https://dev.realworldocaml.org/install.html
## Configuration
Prelude disables Merlin's own linting in favor of Flycheck. It also
leverages Merlin's company-mode backend instead of using directly
Merlin's rudimentary auto-completion system.