Install OCaml
Install
Install opam, the package manager for OCaml.
sudo pacman -S opam
Dune, the OCaml build tool, is installed using opam.
opam install dune
Basic Usage
REPL can be used by running ocaml
.
% ocaml
OCaml version 4.13.1
# 1+1;;
- : int = 2
# exit 0;;
To create a new project using Dune, run dune init
.
dune init exe myproj
.
├── _build
│ └── log
├── dune
└── myproj.ml
To build a project, run dune build
.
.
├── _build
│ ├── default
│ │ ├── dune
│ │ ├── myproj.exe
│ │ └── myproj.ml
│ └── log
├── dune
├── dune-project
└── myproj.ml
To execute, run dune exe
.
dune exec ./myproj.exe