OCaml Changelog

RSS

Read the latest releases and updates from the OCaml ecosystem.

Bug fix release before major version.

See full changelog
  • reintroduce lazy substitution to fix performance issue
  • add "FINDLIB_PATH" directive to .merlin (contributed by Gerd Stolpmann)
  • relax arity checks on externals (harmless, requested by Hongbo Zang)
  • handle case insensitivity of OS X (fix longstanding bug)
  • fix build under Cygwin
  • minor cleanup, portability and usability improvements in build system and editor modes

We are pleased to announce a preview release for opam 2.0, with over 700 patches since 1.2.2. Version 2.0~alpha4 has just been released, and is ready to be more widely tested.

This version brings many new features and changes, the most notable one being that OCaml compiler packages are no longer special entities, and are replaced by standard package definition files. This in turn means that opam users have more flexibility in how switches are managed, including for managing non-OCaml environments such as Coq using the same familiar tools.

A Few Highlights

This is just a sample, see the full changelog for more:

  • Sandboxed builds: Command wrappers can be configured to, for example, restrict permissions of the build and install processes using Linux namespaces, or run the builds within Docker containers.

  • Compilers as packages: This brings many advantages for opam workflows, such as being able to upgrade the compiler in a given switch, better tooling for local compilers, and the possibility to define coq as a compiler or even use opam as a generic shell scripting engine with dependency tracking.

  • Local switches: Create switches within your projects for easier management. Simply run opam switch create <directory> <compiler> to get started.

  • Inplace build: Use opam to build directly from your source directory. Ensure the package is pinned locally then run opam install --inplace-build.

  • Automatic file tracking:: opam now tracks the files installed by packages and is able to cleanly remove them when no existing files were modified. The remove: field is now optional as a result.

  • Configuration file: This can be used to direct choices at opam init automatically (e.g. specific repositories, wrappers, variables, fetch commands, or the external solver). This can be used to override all of opam's OCaml-related settings.

  • Simpler library: the OCaml API is completely rewritten and should make it much easier to write external tools and plugins. Existing tools will need to be ported.

  • Better error mitigation: Through clever ordering of the shell actions and separation of build and install, most build failures can keep your current installation intact, not resulting in removed packages anymore.

Roll out

You are very welcome to try out the alpha, and report any issues. The repository at opam.ocaml.org will remain in 1.2 format (with a 2.0 mirror at opam.ocaml.org/2.0~dev in sync) until after the release is out, which means the extensions can not be used there yet, but you are welcome to test on local or custom repositories, or package pinnings. The reverse translation (2.0 to 1.2) is planned, to keep supporting 1.2 installations after that date.

The documentation for the new version is available at https://opam.ocaml.org/doc/2.0/. This is still work in progress, so please do ask if anything is unclear.

Interface changes

Commands opam switch and opam list have been rehauled for more consistency and flexibility: the former won't implicitly create new switches unless called with the create subcommand, and opam list now allows to combine filters and finely specify the output format. They may not be fully backwards compatible, so please check your scripts.

Most other commands have also seen fixes or improvements. For example, opam doesn't forget about your set of installed packages on the first error, and the new opam install --restore can be used to reinstall your selection after a failed upgrade.

Repository changes

While users of opam 1.2 should feel at home with the changes, the 2.0 repository and package formats are not compatible. Indeed, the move of the compilers to standard packages implies some conversions, and updates to the relationships between packages and their compiler. For example, package constraints like

available: [ ocaml-version >= "4.02" ]

are now written as normal package dependencies:

depends: [ "ocaml" {>= "4.02"} ]

To make the transition easier,

  • upgrade of a custom repository is simply a matter of running opam-admin upgrade-format at its root;
  • the official repository at opam.ocaml.org already has a 2.0 mirror, to which you will be automatically redirected;
  • packages definition are automatically converted when you pin a package.

Note that the ocaml package on the official repository is actually a wrapper that depends on one of ocaml-base-compiler, ocaml-system or ocaml-variants, which contain the different flavours of the actual compiler. It is expected that it may only get picked up when requested by package dependencies.

Package format changes

The opam package definition format is very similar to before, but there are quite a few extensions and some changes:

  • it is now mandatory to separate the build: and install: steps (this allows tracking of installed files, better error recovery, and some optional security features);
  • the url and description can now optionally be included in the opam file using the section url {} and fields synopsis: and description:;
  • it is now possible to have dependencies toggled by globally-defined opam variables (e.g. for a dependency needed on some OS only), or even rely on the package information (e.g. have a dependency at the same version);
  • the new setenv: field allows packages to export updates to environment variables;
  • custom fields x-foo: can be used for extensions and external tools;
  • allow """ delimiters around unescaped strings
  • & is now parsed with higher priority than |
  • field ocaml-version: can no longer be used
  • the remove: field should not be used anymore for simple cases (just removing files)

Let's go then -- how to try it ?

First, be aware that you'll be prompted to update your ~/.opam to 2.0 format before anything else, so if you value it, make a backup. Or just export OPAMROOT to test the alpha on a temporary opam root.

Packages for opam 2.0 are already in the opam repository, so if you have a working opam installation of opam (at least 1.2.1), you can bootstrap as easily as:

opam install opam-devel

This doesn't install the new opam to your PATH within the current opam root for obvious reasons, so you can manually install it as e.g. "opam2" using:

sudo cp $(opam config var "opam-devel:lib")/opam /usr/local/bin/opam2

You can otherwise install as usual:

  • Using pre-built binaries (available for OSX and Linux x86, x86_64, armhf) and our install script:

    wget https://raw.github.com/ocaml/opam/2.0-alpha4-devel/shell/opam_installer.sh -O - | sh -s /usr/local/bin

    Equivalently, pick your version and download it to your PATH;

  • Building from our inclusive source tarball: download here and build using ./configure && make lib-ext && make && make install if you have OCaml >= 4.01 already available, make cold && make install otherwise;

  • Or from source, following the included instructions from the README. Some files have been moved around, so if your build fails after you updated an existing git clone, try to clean it up (git clean -fdx).

See full changelog
  • fixes on nested try-with and some cases of comments
  • better alignment of stand-alone semicolons in records
  • improved emacs and vim scripts
  • better indentation within extension blocks
See full changelog
  • frontend:
    • now all commands can take a context, this reduce the amount of state in the command interpreter. Long term goal is to make protocol stateless
    • merlin now supports customizable "readers": processes responsible for parsing and pretty-printing. Main use-case is Reason, cppo/optcomp support might be added later
  • backend:
    • drop support for 4.00 / 4.01
    • support for 4.03 has been added
    • new implementation of type recovery, should diverge less from upstream
    • support for 4.02 was reimplemented to use the same design
    • menhir's fork has been synchronized with upstream, recovery algorithm is completely new
  • vim: add support for python3, update to new protocol
  • emacs: update to new protocol, bug fixes

Utop 1.19

See full changelog
  • allow to configure the external editor with UTop.set_external_editor
  • add UTop.set_margin_function to allow users to set the margin for the toplevel outcome. It is 80 by default
  • better for quoted strings ({|...|})
  • add a #pwd directive
  • experimental support for running utop in the middle of a program with UTop_main.interact
  • fix Async integration (automatic waiting of _ Deferred.t value). The new version is more robust against future change in Async
  • fix use of the non-existing replace-in-string function in the emacs mode (Syohei Yoshida)
  • fallback to Latin-1 for invalid UTF-8 sequences in the compiler output
See full changelog
  • backend:

    • improve support for module aliases in completion, locate and short-path
    • change management of flags
    • Cuillère ou Dorade
    • fix grammar for 4.02.3, support attributes on core_types
  • emacs & vim: minor fixes

Merlin 2.3

This release also contains contributions from: Rudi Grinberg, Fourchaux, Christopher Reichert, David Allsopp, Nick Borden, Mario Rodas, @Twinside, Pierre Chambart, Philipp Haselwarter, Tomasz Kołodziejski and Syohei Yoshida.

See full changelog
  • backend:

    • locate: fix assert failure on first class modules inclusion
    • outline: add support for classes and object types
    • nonrec: enable by default for OCaml >= 4.02.2
    • error reporting: less aggressive filtering on ghost locs
    • finer-grained tracking of usage (values, opened modules, etc)
    • significant improvement in the handling of PPX extensions:
      • fix shell commandline and working directory
      • normalize parsetree locations
      • implement caching of intermediate rewriting
    • merged support for MetaOCaml
    • path to the standard library can now be specified with STDLIB command in .merlin
    • BrowseT: split into Browse_node (OCaml version specific) and Merlin_browse, extract recursion scheme
    • add Jump command, contributed by Tomasz Kołodziejski
    • contextual-commands: optionnally specify the context (file, project) in which each command is interpreted
    • better support for trunk
    • many bugfixes
  • documentation:

    • update ARCHITECTURE and PROTOCOL documentations
  • emacs:

    • make use of contextual-commands, non backward compatible protocol change
    • new merlin-set-flags command
    • split into multiple files
    • cleanup symbol namespaces:
      • merlin- for user targeted definitions
      • merlin-- for internal definitions,
      • merlin/ for API definitions
    • usability tweaks, notably on error display and navigation
    • general cleanup and bugfixes
  • vim:

    • expose custom .merlin loading through buffer variable
    • cleanup and bugfixes, notably process liveness check and restart
See full changelog
  • generic handling of ppx keywords
  • much improved vim binding
  • changed installation location of vim bindings (to share/ocp-indent/vim/indent) for easier autoload
  • don't increase indentation level for sequences of try..with
  • support for '[@'
  • restore back-alignment of '&&', '||' after 'if' and 'when'
  • support for extensible variant types
See full changelog
  • Add two-factor authentication support
  • Now requires github >= 1.0.0, opam-lib = 1.2.2
  • Use the finer lint results from opam-lib
  • Fix a terminal corruption bug from Ctrl-C at password prompt
  • Improve GitHub API error reporting
  • Fix GitHub token file permissions security vulnerability
  • Fix GitHub token errors for revoked or unknowable (since 2015/04/20) tokens

Utop 1.18

See full changelog
  • emace mode improvements (Mads Hartmann Jensen)
    • add utop-minor-mode to make integration with major modes cleaner
    • clean-up of the elisp code
  • add UTop.end_and_accept_current_phrase to avoid typing ;; at the end of every phrases
  • fix compatibility with OCaml trunk

Merlin 2.2

See full changelog
  • backend:

    • completion
      • return the type of the expected argument when completing an application. This allows us to offer completion for named and optional parameters, as well as polymorphic variants
      • optionally associates ocamldoc comments to candidates
      • adds field completion inside records ( #296 )
    • locate:
      • partially rewritten, introduces a new kind of cache (so potentially noticeably bigger memory consumption)
      • better handling of functors
      • handle local modules
      • fix occasional "inconsistent assumptions"
    • error reporting:
      • handle environment errors (inconsistent assumptions, …)
      • filter duplicated messages
      • fix type error reporting: "this expression has type t = t but an expression was expected of type u = u" we now only print the equality when it adds some information
      • less noisy pattern recovery: when every pattern is recovered, consider that the matched expression is the the source of the problem, and retry typing with "'a" as the type of the matched expression.
    • add support for trunk
    • add a "document" command: takes an ident and return its documentation (if any)
    • destruct: use more precise environments ( #389 )
    • warnings:
      • check signature inclusion to prevent spurious warnings about unused declarations
      • backport 4.02-style warning management
      • add a dump command
    • nonrec: update implementation to more-or-less match the upstream one (upstream >= 4.02.2)
    • parser: improve marking heuristic in presence of ;; or toplevel directives.
    • typeof: during verbose expansion, also print the type declaration if we have a type constructor
  • emacs:

    • fix bindings of every completion backend
    • bind ocamldoc comments to company (optional)
    • detect race conditions when running synchronous commands
    • cleanup "merlin-process-started-p"
    • locate error messages were silently ignored, they are now printed
    • drop text properties from commands sent to merlin (pull request #383 by milanst)
    • Tell merlin the content of the buffer when opening a new buffer. This allows merlin idle-job to preload content if nothing else is requested.
    • remove call to merlin from the lighter
  • vim:

    • fix ctrlp binding for locate
    • add (dwim) completion on :TypeOf
    • while completing, candidates documentation can be displayed in the "preview" window
    • prefix every command name by "Merlin" ( #379 )
    • Tell merlin the content of the buffer when opening a new buffer. This allows merlin idle-job to preload content if nothing else is requested.

OPAM 1.2.2 has just been released. This fixes a few issues over 1.2.1 and brings a couple of improvements, in particular better use of the solver to keep the installation as up-to-date as possible even when the latest version of a package can not be installed.

Upgrade from 1.2.1 (or earlier)

See the normal installation instructions: you should generally pick up the packages from the same origin as you did for the last version -- possibly switching from the official repository packages to the ones we provide for your distribution, in case the former are lagging behind.

There are no changes in repository format, and you can roll back to earlier versions in the 1.2 branch if needed.

Improvements

  • Conflict messages now report the original version constraints without translation, and they have been made more concise in some cases
  • Some new opam lint checks, opam lint now numbers its warnings and may provide script-friendly output
  • Feature to automatically install plugins, e.g. opam depext will prompt to install depext if available and not already installed
  • Priority to newer versions even when the latest can't be installed (with a recent solver only. Before, all non-latest versions were equivalent to the solver)
  • Added opam list --resolve to list a consistent installation scenario
  • Be cool by default on errors in OPAM files, these don't concern end-users and packagers and CI now have opam lint to check them.

Fixes

  • OSX: state cache got broken in 1.2.1, which could induce longer startup times. This is now fixed
  • opam config report has been fixed to report the external solver properly
  • --dry-run --verbose properly outputs all commands that would be run again
  • Providing a simple path to an aspcud executable as external solver (through options or environment) works again, for backwards-compatibility
  • Fixed a fd leak on solver calls (thanks Ivan Gotovchits)
  • opam list now returns 0 when no packages match but no pattern was supplied, which is more helpful in scripts relying on it to check dependencies.

OPAM 1.2.1 has just been released. This patch version brings a number of fixes and improvements over 1.2.0, without breaking compatibility.

Upgrade from 1.2.0 (or earlier)

See the normal installation instructions: you should generally pick up the packages from the same origin as you did for the last version -- possibly switching from the official repository packages to the ones we provide for your distribution, in case the former are lagging behind.

What's new

No huge new features in this point release -- which means you can roll back to 1.2.0 in case of problems -- but lots going on under the hood, and quite a few visible changes nonetheless:

  • The engine that processes package builds and other commands in parallel has been rewritten. You'll notice the cool new display but it's also much more reliable and efficient. Make sure to set jobs: to a value greater than 1 in ~/.opam/config in case you updated from an older version.
  • The install/upgrade/downgrade/remove/reinstall actions are also processed in a better way: the consequences of a failed actions are minimised, when it used to abort the full command.
  • When using version control to pin a package to a local directory without specifying a branch, only the tracked files are used by OPAM, but their changes don't need to be checked in. This was found to be the most convenient compromise.
  • Sources used for several OPAM packages may use <name>.opam files for package pinning. URLs of the form git+ssh:// or hg+https:// are now allowed.
  • opam lint has been vastly improved.

... and much more

There is also a new manual documenting the file and repository formats.

Fixes

See the changelog for a summary or closed issues in the bug-tracker for an overview.

Experimental features

These are mostly improvements to the file formats. You are welcome to use them, but they won't be accepted into the official repository until the next release.

  • New field features: in opam files, to help with ./configure scripts and documenting the specific features enabled in a given build. See the original proposal and the section in the new manual
  • The "filter" language in opam files is now well defined, and documented in the manual. In particular, undefined variables are consistently handled, as well as conversions between string and boolean values, with new syntax for converting bools to strings.
  • New package flag "verbose" in opam files, that outputs the package's build script to stdout
  • New field libexec: in <name>.install files, to install into the package's lib dir with the execution bit set.
  • Compilers can now be defined without source nor build instructions, and the base packages defined in the packages: field are now resolved and then locked. In practice, this means that repository maintainers can move the compiler itself to a package, giving a lot more flexibility.

Main new feature is a faster short-path, and also a lot of buxfixes.

See full changelog
  • backend:

    • merge new implementation of short-path
    • infrastructure for doing background computations
    • fix exhaustivity checking of GADTs
    • fix Typecore error reporting in 4.00.1 & 4.01.0
    • delayed checks are now enabled (e.g warnings)
    • special handling of "myocamlbuild.ml" (issue #363)
    • better sharing/caching of global modules
    • more customizable .merlin loading
    • minor fixes (better error messages, typos, "fake" extensions)
  • build system:

    • allow bytecode builds, support OpenBSD (pull request #364 by madroach)
    • Refuse/Resist... environment variables redefinition
  • vim:

    • fix charset/encoding detection (pull request #352 by rgrinberg)
    • minor fixes and simplification
  • emacs:

    • better integration with emacs error management and asynchronous handling
    • expose custom .merlin loading in merlin-grouping-function
    • fixes, printf-debugging cleanup
See full changelog
  • new vim binding
  • support for ppx lwt keywords
  • fixed indentation at BOF and EOF in some cases
  • back-alignment of '&&' and '||' disabled
  • tweaks to functor, struct and module indentation
  • support for ppx attributes
  • lots of fixes and tweaks
See full changelog
  • backend:

    • locate: merlin refused to locate things when it had no context (happens when the buffer didn't parse for example) claiming it was at the "definition point". Fixed.
    • locate: use the cmt path when no ml file was found in the source path (this might not be such a good idea, the cases when this work are the ones where the user configuration is wrong...)
    • destruct: qualify introduced constructors
    • destruct: eliminate "impossible" GADT branches
    • parser: handle '%' as an operator for 4.00 and 4.01 ( #345 )
  • fake:

    • add typerep support
    • never generate '_ type variables.
  • vim:

    • show duplicated outlines in CtrlP
    • sort outlines by name length in CtrlP
    • when split method is set to 'tab' always open a new tab.

This release also contains contributions from: Geoff Gole, Rudi Grinberg, Markus Mottl, Roman Vorobets and Arthur Wendling.

See full changelog
  • backend:

    • add PPX support
    • make use of context before locating (#308, #316, #318).
    • generate match patterns for arbitrary expressions and missing patterns for incomplete matchings (#123).
    • reintroduce type expansion (asking the times of the same expression several times will resolve type aliases).
    • "smart" (a.k.a "do what I mean") completion: L.m will expand to List.map ; List.m... ; ListLabels.map ; ... if L doesn't exist.
    • simplify incremental parser and typer interfaces
    • locate: better handling of packed modules (supposedly)
    • more precise recovery on patterns (before the recovery was done at the expression level, so the whole match was discarded, now only the pattern is)
  • emacs:

    • don't use fringe in emacs23 (broken)
    • remove obsolete aliases: merlin-occurences => merlin-occurrences merlin-to-end => merlin-error-check
    • disable merlin-mode on type buffer
    • require caml-types (needed for highlighting) (#331).
  • misc:

    • update README (#301).
  • vim:

    • add a type history buffer (#313, #322) -- only available for vim > 7.3.
    • highlight types when displaying them in the command line -- only for vim > 7.3
    • add tab completion for the argument of the :Locate command
    • add support for text objects based on type enclosing
    • introduce an interactive version of :Rename
    • locate results can now be shown in a new or existing tab (#335)
    • use fileencoding where necessary (#332)
    • ctrlp bindings for outline and locate

Utop 1.17

See full changelog
  • re-export Config.load_path as UTop.load_path (Peter Zotov)
  • enable utop-command to be buffer-local (Mads Hartmann Jensen)
  • fix 4.01 compatibility (Peter Zotov)

Utop 1.16

See full changelog
  • make camlp4 support optional
  • require OCaml 4.01.0 or newer
  • implement wrapper for -safe-string

We are very proud to announce the availability of OPAM 1.2.0.

Upgrade from 1.1

Simply follow the usual instructions, using your preferred method (package from your distribution, binary, source, etc.) as documented on the homepage.

NOTE: There are small changes to the internal repository format (~/.opam). It will be transparently updated on first run, but in case you might want to go back and have anything precious there, you're advised to back it up.

Usability

Lot of work has been put into providing a cleaner interface, with helpful behaviour and messages in case of errors.

The documentation pages also have been largely rewritten for consistency and clarity.

New features

This is just the top of the list:

  • A extended and versatile opam pin command. See the Simplified packaging workflow
  • More expressive queries, see for example opam source
  • New metadata fields, including source repositories, bug-trackers, and finer control of package behaviour
  • An opam lint command to check the quality of packages

For more detail, see the announcement for the beta, the full changelog, and the bug-tracker.

Package format

The package format has been extended to the benefit of both packagers and users. The repository already accepts packages in the 1.2 format, and this won't affect 1.1 users as a rewrite is done on the server for compatibility with 1.1.

If you are hosting a repository, you may be interested in these administration scripts to quickly take advantage of the new features or retain compatibility.

If you want to contribute to a new release announcement, check out the Contributing Guide on GitHub.