OCaml: Package management


opam

opam switches are comparable to python's venvs: https://ocaml.org/docs/opam-switch-introduction

Many useful packages related to Coq are available only after adding this repo:

opam repo add coq-released https://coq.inria.fr/opam/released

Reference: https://opam.ocaml.org/doc/Usage.html

dune

General

Starting off

# Initialize new project
dune init proj <proj-name>

dune build
dune exec

References: https://ocaml.org/docs/up-and-running


Both of the following are equivalent??

dune exec -- <cmd>
dune install; <cmd>

Don't treat a warning as error

(executable
  (name lexer)
  (flags (:standard (-warn-error -32))))

https://dune.readthedocs.io/en/latest/concepts/ocaml-flags.html

Useful packages/tools

Jane Street libraries:

Historical:

Loading base (Jane Street)

base is a package from janestreet.

# #use "topfind";;
# #require "base";;
# open Base;;

base < corekernel < core

The extra # are needed.