Skip to content

Instantly share code, notes, and snippets.

@dbuenzli
dbuenzli / opam-v2-switch-init.md
Created July 16, 2017 23:06
opam v2 switch init

Switch creation and initialization in opam v2.

The first point for me is that we should as much as possible get to a system where the following basic sequences of steps are possible.

opam switch create bla               # Create switch
opam install non-ocaml-pkg           # Doesn't depend on ocaml
opam install ocaml.V.VV.V+variant

or

@dbuenzli
dbuenzli / sys-pkg-list.md
Last active July 20, 2017 11:48
Package lists for system package managers depexts
@dbuenzli
dbuenzli / utf_8.mli
Last active July 9, 2017 22:59
UTF_8 module
(* See http://erratique.ch/software/uutf/doc/Uutf.String.UTF_8.html
If you want to test the API use:
opam pin add uutf https://github.com/dbuenzli/uutf.git#string-utf-8 *)
(** UTF-8 encoded strings.
The [UTF_8] module provides a {{!t}datatype} that asserts
that a string value is valid UTF-8 and a few functions
@dbuenzli
dbuenzli / opam-v2-testing.md
Last active July 5, 2017 12:21
opam 1.2.2 to 2.0.0 and back with brew on macOS

From opam 1.2.2 to 2.0.0 and back with homebrew on macOS

With these instructions you can try 2.0.0 for your day to day work but quickly and safely go back to 1.2.2 if you hit a wall. This maintains both setup entirely isolated.

Going to 2.0.0 for the first time:

> mv ~/.opam ~/.opam-v1 # Save your old setup, use cp -r if you want

@dbuenzli
dbuenzli / free.ml
Last active May 14, 2017 13:48
Freer monad derivations.
(*---------------------------------------------------------------------------
Copyright (c) 2015 Daniel C. Bünzli. All rights reserved.
Distributed under the BSD3 license, see license at the end of the file.
%%NAME%% release %%VERSION%%
---------------------------------------------------------------------------*)
(* An OCaml derivation of http://okmij.org/ftp/Computation/free-monad.html *)
module type FUNCTOR = sig
type 'a t
let delete ?(must_exist = false) ~contents d =
let err d msg =
raise_notrace (Failure (strf "delete %a: %s" B0_fpath.pp d msg))
in
let try_unlink file = match Unix.unlink (B0_fpath.to_string file) with
| () -> true
| exception Unix.Unix_error (e, _, _) ->
match e with
| Unix.ENOENT -> true
| Unix.EISDIR (* Linux *) | Unix.EPERM (* POSIX *) -> false
@dbuenzli
dbuenzli / topkg-blurb.md
Last active April 12, 2017 20:49
topkg-blurb

There is one issue that bazaars, library operating systems like MirageOS or random left-padists face: how to scale extreme software modularization. Scaling not from a software composition perspective; this could be readily solved by using the type system and the functional programming techniques everyone's heard about. But scaling from a purely bureaucratic point of view.

The bureaucracy of making sure main issues are being taken care of. The bureaucracy of making sure changes to the software are being clearly communicated to dependents. The bureaucracy of making sure the software

(*---------------------------------------------------------------------------
Copyright (c) 2017 Daniel C. Bünzli. All rights reserved.
Distributed under the ISC license, see terms at the end of the file.
%%NAME%% %%VERSION%%
---------------------------------------------------------------------------*)
open Gg
open Vg
open React
open Useri
<test*> : use_c, use_a, use_b
@dbuenzli
dbuenzli / .block
Last active September 16, 2016 23:58
license: gpl-3.0