CI | Status |
---|---|
Circle CI (on Linux) | |
Azure DevOps (on macOS) |
OCaml Version Hello World Program
git clone https://github.com/xiaoxiangmoe/ocaml-helloworld.git
opam switch create . --yes
# opam switch create ./ --locked --yes
opam exec --switch . -- dune utop
utop # open Lib;;
utop # #show Math.add;; (* 1 *)
val add : int -> int -> int
utop # Math.add 1 2;; (* 2 *)
- : int = 3
utop # let add2 = Math.add 2;; (* 3 *)
val add2 : int -> int = <fun>
utop # add2 5;; (* 4 *)
- : int = 7
# build
opam exec --switch . -- dune build ./bin/main.exe
# run
./_build/default/bin/main.exe
opam exec --switch . -- dune build @doc
open _build/default/_doc/_html/index.html
opam exec --switch . -- dune runtest
# install
opam install the-library-name --yes
# do not update opam lock file
# opam lock
# modify opam file to add deps
vim ./opam
# modify dune file to add deps
vim ./???/dune
- do not use lock-file
- do not use switch export
- do not use test dependency