OCaml for the impatient - Adam Bard and his magical blog. This is the most up to date setup using Opam, jbuilder, Merlin, VSCode etc.,. August 2017.
See also: opam
typerex = Excellent IDE.
ocamlbrowser in a shell to see a
tk based documentaiton browser.
Fortunately, you can install it using
ocamleditor… unfortunately you are dealing with various
idiosyncrasis of gtk on mac… ugh.. To keep it short,
installation by opam might fail with
pkg-config errors. The fix is:
… before running
opam install ocamleditor. Solution
Note: looks butt-ugly on mac, as expected.
opam allows you create “sandboxes” and install packages in them. See the
-A --alias-of option.
See Setting up an OCaml environment for Programming. Use
Apr 2016. See ogen – a tool for creating new OCaml projects with OPAM, Oasis, and Merlin.
Compiling an ocaml file:
That has no dependecies
ocamlopt foo.ml -o foo
that has a dependency (say csv)
ocamlfind ocamlopt -o test -linkpkg -package csv test.ml
ocamlfindis a program that finds all the ocaml packages that are installed on your system (or opam instance, for that matter).
ocamlfind -hto see list of commands available.
ocamlfind printconfshows the path configs etc.,
ocamlfind listwill list all the packages installed.
ocamldep *.ml, which will dumps dependency lines.
Different file types
Ocaml has good study materials – textbooks, lecture notes. There is also the advantage of being able to roll-over to F# for “enterprise” stuff.
-How OCaml Type Checker works. In general Olegs http://okmij.org/ftp/ is a treasure trove of CS material.
- Memory Layout in Ocaml – comment by
- Why OCaml . Also has many links to OCaml pages. - OCaml programming with
- Another Why OCaml
- OCaml briefly – a brief tour of OCaml.
- What is the appeal of OCaml today? Why use it over something like Haskell or Java (reddit); 2018-07-11.
Some opinions on the merits of using these tools:
oasismay be better now.
ocamlbuildcomes with the distribution.
myocamlbuild.mlfile automatically for you.
oasisgives you access to
oasis-db, a CPAN like system.
opamreally doesn’t care about build systems.
type download_result = [ `aborted_by_user | `network_failure of string | `success of filepath ]
esumii/min-caml: a complete optimizing native-code compiler for a reasonably usable subset of OCaml, in 2000 lines of OCaml. Paper.
PSA: Tired of inscrutable type errors from OCaml? If you use jbuilder/dune, just add this to your jbuild build stanza:
(flags (:standard -short-paths))and your type errors and inferred types from Merlin will magically improve!