opam switches are comparable to python's venvs: https://ocaml.org/docs/opam-switch-introduction
Show switches available to be installed: opam switch list-available
opam switch list-available --all
Activate: eval $(opam env)
Create new switch: opam switch create <switch-name>
opam switch create 5.1.1
Delete a switch: opam switch remove <switch-name>
default
??List switches: opam switch
Go to a switch: opam switch <switch-name>
List installed packages: opam list
or opam list -i
opam list -a
Change switch: opam switch set <switch-name>
Install a package (to current switch): opam install <package-name>
Remove a package: opam remove <package-name>
Update package list: opam update
Show version of an installed package: opam info <package-name>
—
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 exec ./lexer.exe
.exe
extension to the executables that it makesname
field of executable
is the entry point.
main
for main.ml
# 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>
(executable
(name lexer)
(flags (:standard (-warn-error -32))))
https://dune.readthedocs.io/en/latest/concepts/ocaml-flags.html
Jane Street libraries:
Historical:
base is a package from janestreet.
# #use "topfind";;
# #require "base";;
# open Base;;
base < corekernel < core
The extra #
are needed.