Search code examples
ocamlopam

installing an opam package with a restrictive bound


Right now ocaml-lsp-server is restricted to ocaml>=4.13 & <4.14

Is there an easy way to force-install it on an "opam switch" having a higher version ?

Is it unthinkable that it could work ?

> opam list
# Packages matching: installed
# Name              # Installed  # Synopsis
...
ocaml               4.14.0       The OCaml compiler (virtual package)
ocaml-compiler-libs v0.12.4      OCaml compiler libraries repackaged
ocaml-config        2            OCaml Switch Configuration
ocaml-variants      4.14.0+trunk Latest 4.14.0 development
...
> opam switch invariant
["ocaml-variants" {= "4.14.0+trunk"}]

Solution

  • At the time of this question, OCaml 4.14 has not been released yet.

    The ocaml-lsp server is based on merlin which is itself strongly coupled to the compiler due to its use of the typechecker internal API. Moreover, merlin will be in flux for 4.14 until the release of the first beta release of OCaml 4.14.0 (due to the upstreaming of some part of the Merlin codebase to the compiler).

    The easiest way (which is not easy at all) is thus to port ocaml-lsp-server to 4.14 yourself and maintain it while waiting for the official version.