Skip to content

Instantly share code, notes, and snippets.

View opam #4445
> opam switch create 4.06.0 --debug-level=3
00:00.003 GSTATE LOAD-GLOBAL-STATE @ /Users/dbuenzli/.opam
00:00.004 SYSTEM LOCK /Users/dbuenzli/.opam/lock (none => read)
00:00.004 SYSTEM LOCK /Users/dbuenzli/.opam/config.lock (none => write)
00:00.004 FILE(config) Read ~/.opam/config in 0.000s
00:00.005 RSTATE LOAD-REPOSITORY-STATE @ /Users/dbuenzli/.opam
00:00.008 FILE(repos-config) Read ~/.opam/repo/repos-config in 0.003s
00:00.008 SYSTEM LOCK /Users/dbuenzli/.opam/repo/state.cache (none => read)
00:00.108 RSTATE Loaded /Users/dbuenzli/.opam/repo/state.cache in 0.099s
00:00.264 SYSTEM LOCK /Users/dbuenzli/.opam/repo/state.cache (read => none)
@dbuenzli
dbuenzli / landmark.md
Created Oct 22, 2020
How to landmark
View landmark.md
echo 'true : package(landmarks.ppx,landmarks)' >> _tags
export OCAML_LANDMARK=auto
topkg build 
topkg run exe 
@dbuenzli
dbuenzli / ocaml-deprecate.md
Last active Nov 11, 2019
Deprecation procedure for OCaml
View ocaml-deprecate.md

Deprecation procedure for OCaml

In order to deprecate a feature from the OCaml system the following steps are taken:

  1. Introduce a workaround for the deprecation (if needed). Document the workaround, see below.
  2. When Debian stable has the version in which the workaround was introduced, start deprecating the feature with a visible warning
@dbuenzli
dbuenzli / readmeta.ml
Last active Oct 15, 2019
Read cma/cmxa/cmxs link metadata
View readmeta.ml
(*
ocamlfind ocamlopt -o readmeta -linkpkg \
-package dynlink,compiler-libs.optcomp,compiler-libs.bytecomp readmeta.ml
*)
let read_cma ic =
let lib =
let toc_pos = input_binary_int ic in
seek_in ic toc_pos;
(input_value ic : Cmo_format.library)
@dbuenzli
dbuenzli / ocamlib.md
Last active Jan 10, 2020
OCaml compiler support for library linking
@dbuenzli
dbuenzli / ocaml-emacs.md
Last active Mar 27, 2020
Emacs setup for ocaml
View ocaml-emacs.md

Install the following opam packages:

opam install caml-mode merlin ocp-indent

Tweak your .emacs file with some or all of the following:

; shift tab to complete
(global-set-key (kbd "S-<tab>") 'company-complete)
@dbuenzli
dbuenzli / ioserial.ml
Last active Apr 12, 2019
Serial connection
View ioserial.ml
(*----------------------------------------------------------------------------
Copyright (c) 2009, Daniel C. Bünzli. All rights reserved.
Distributed under a BSD license, see license at the end of the file.
----------------------------------------------------------------------------*)
let str = Printf.sprintf
let exec = Filename.basename Sys.executable_name
let pr = Format.printf
let pr_err s = Printf.eprintf "%s:%s\n" exec s
@dbuenzli
dbuenzli / opam
Last active Jan 17, 2018
opam-set-env
View opam
opam-version: "2.0"
synopsis: "Build setenv"
maintainer: "Daniel Bünzli <daniel.buenzl i@erratique.ch>"
setenv: [[BLA += "BLA"]]
authors:[]
build:[[ "env" ]]
@dbuenzli
dbuenzli / opam
Created Jan 12, 2018
opam-build-env
View opam
opam-version: "2.0"
synopsis: "Build environment"
maintainer: "Daniel Bünzli <daniel.buenzl i@erratique.ch>"
authors:[]
build:[[ "env" ]]
@dbuenzli
dbuenzli / Vagrantfile
Created Dec 21, 2017
Install OCaml 4.06 in a Win10 VM with vagrant
View Vagrantfile
# Download vagrant box for Windows 10 from:
#
# https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/
#
# Unzip and add with:
#
# vagrant box add --name win10 MSEdge\ -\ Win10.box
#
# During the first `vagrant up` need to connect to vm UI to do this:
#