1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
exception At of ((int * int) * exn)
let ($) f g = function x -> f (g x)
external identity : 'a -> 'a = "%identity"
let flip f x y = f y x
let tuck l x = l := x :: !l
let option_list = function Some x -> [x] | None -> []
let fail fmt = Printf.ksprintf failwith fmt
let failed ~at fmt = Printf.ksprintf (fun s -> raise (At (at, Failure s))) fmt
let printfn fmt = Printf.ksprintf print_endline fmt
let eprintfn fmt = Printf.ksprintf prerr_endline fmt