Skip to content

Instantly share code, notes, and snippets.

type t = {
name : string;
tags : Tag.S.t;
}
let mk name tags = { name; tags; }
let tags t = t.tags
(** Subset of the Set.S signature *)
module type Set = sig
type t
val subset : t -> t -> bool
end
let f (type set) (module S : Set with type t = set) (s : set) (l : set list) =
List.exists (S.subset s) l
module Foo = struct
let view = function
| 0 -> `A
| 1 -> `B
| 2 -> `C
| _ -> `Other
end
let view = function
| 0 -> `A
| 1 -> `B
| 2 -> `C
| _ -> `Foobar
module Foo = struct
let view = view
end
@Gbury
Gbury / comp.ml
Created December 16, 2019 13:36
Comparison of comparisons, ^^
open Core_bench
module type S = sig
type t
val n : int
val poly : t -> t -> int
val quad : t -> t -> int
val discr : t -> t -> int
val test_values : (string * t * t) list
end
@Gbury
Gbury / #foo.ml
Last active August 29, 2019 11:58
─( 13:56:23 )─< command 1 >──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────{ counter: 0 }─
utop # type foo = [`A | `B ];;
type foo = [ `A | `B ]
─( 13:56:27 )─< command 2 >──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────{ counter: 0 }─
utop # let f = function #foo -> 0;;
val f : [< foo ] -> int = <fun>
─( 13:56:32 )─< command 3 >──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────{ counter: 0 }─
utop # let f = function #foo -> 0 | `C -> 1;;
val f : [< `A | `B | `C ] -> int = <fun>
let rec flat_map_rec f s =
Seq.flat_map (fun x ->
match f x with
| `Ok -> Seq.return x
| `Seq s' -> flat_map_rec f s'
) s
" Opam path
let g:opamshare = substitute(system('opam config var share'),'\n$','','''')
" Merlin
execute "set rtp+=" . g:opamshare . "/merlin/vim"
let g:syntastic_ignore_files = ['\m\c\.ml[ly]$']
let g:syntastic_ocaml_checkers = ['merlin']
" Make syntastic populate the location list to allow jumping to the next error
let g:syntastic_always_populate_loc_list = 1
@Gbury
Gbury / foo.ml
Created November 21, 2018 09:51
module WI = Weak.Make(
struct
type t = int
let hash i = i
let equal i j = i = j
end)
let wi = WI.create 17
let f () =
(**
Proof automatically generated by Archsat
Input file: eq_diamond6.smt2
**)
(* File '/home/guigui/build/bench/smtlib/QF_UF/eq_diamond/eq_diamond6.smt2', line 11, character 0-18 *)
Parameter U : Type.
(* File '/home/guigui/build/bench/smtlib/QF_UF/eq_diamond/eq_diamond6.smt2', line 12, character 0-21 *)