OCaml training

John Else

john.else@citrix.com

johnelse.github.io/ocaml-training

OCaml Features

  • Static type system
  • Type inference
  • Pattern matching
  • Expressive type definitions
  • First-class functions

Tools - OPAM

  • Source-based package manager
  • git/http backends
  • Easy to create repos for testing and installing your own packages
  • Easy to try out new compilers

opam.ocaml.org

Tools - utop

  • User-friendly REPL
  • Tab-completion
  • readline support
  • Much more user-friendly than the standard OCaml toplevel!

opam install utop

github.com/diml/utop

Tools - IOCaml

  • OCaml mode for IPython
  • REPL in a web browser, with embedded markdown
  • Used to display the code samples in this presentation

opam install iocaml

github.com/andrewray/iocaml

Tools - Merlin

  • Code completion and type lookup engine
  • Plugins for vim, emacs

opam install merlin

github.com/the-lambda-church/merlin

emacs installation instructions

vim installation instructions

Another vim guide

Libraries - Unix

Functions for handling:

  • Files
  • Pipes
  • Sockets (unix/network)
  • Processes
  • etc...

INRIA docs

Sockets examples

Libraries - Sys

  • Access to command-line arguments
  • Signal handling
  • Filesystem operations

INRIA docs

Libraries - stdext

Citrix's extensions to the OCaml standard library

  • Stringext, Listext, Unixext, etc...
  • We'd like to deprecate it eventually, but it's used all over our legacy code.

Github link

Libraries - rpclib

  • Create RPC marshalling functions from types
  • Create RPC client and server modules from interfaces

github.com/samoht/ocaml-rpc

Further reading

Help?!

  • irc.freenode.com - #ring3 (private), #ocaml
  • caml-list