OCaml programming language

#programming-language, ocaml


See also: opam

emacs + utop + merlin + typerex = Excellent IDE.

2014-11-25:

OCamlEditor

Fortunately, you can install it using opam install ocamleditor… unfortunately you are dealing with various idiosyncrasis of gtk on mac… ugh.. To keep it short, lablgtk installation by opam might fail with pkg-config errors. The fix is:

https://github.com/Homebrew/homebrew/issues/14123#issuecomment-37896791

… before running opam install ocamleditor. Solution via

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 ocamlfind, ocamlbuild and make.

Apr 2016. See ogen – a tool for creating new OCaml projects with OPAM, Oasis, and Merlin.

Compiling an ocaml file:

ocamlfind

ocamldep

typical usage: 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.

Language

Concurrency

Learning OCaml

Courseware

Tutorials

Best practices

Books

Articles

-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 avsm - Why OCaml [2002]. Also has many links to OCaml pages. - OCaml programming with emacs. - 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.

Blogs

Resources

Papers

Package managers

Talks

Yaron Minsky:

Miscellaneous

OCaml as a replacement language

Writing languages using OCaml

Tools, ecosystem and libraries

Js_of_Ocaml

OCaml project tools

Build tools:

Some opinions on the merits of using these tools:

Code bits

Explicit Typing of a polymorphic variant

type download_result =
  [ `aborted_by_user
  | `network_failure of string
  | `success of filepath ]

via

Information

QQ

Sample code / Read Source

Multicore OCaml

Object oriened OCaml

Hindley-Milner type system

Semantics

Web programming with OCaml

PPX

Comparison

Running log

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! - OCaml+PostgreSQL with Caqti - Natively run OCaml from Rust

min-caml

esumii/min-caml: a complete optimizing native-code compiler for a reasonably usable subset of OCaml, in 2000 lines of OCaml. Paper.