Commit 38cf7a58 authored by Kim Nguyễn's avatar Kim Nguyễn
Browse files

Improve the debugging infrastructure (cherry-pick from

 parts of 802f291e).
parent 578f1470
let margin = ref ""
let increase_margin () = margin := !margin ^ " "
let decrease_margin () = margin := String.sub !margin 0 (max (String.length !margin - 2) 0)
let _DEBUG = fun level ?(enter=false) ?(leave=false) fmt ->
let () =
if enter then begin
Format.eprintf "%s> Entering %s: @\n%!" !margin level;
increase_margin ()
end
else if leave then begin
decrease_margin();
Format.eprintf "\n%s< Leaving %s:@\n%!" !margin level;
end
in
Format.eprintf "%s" !margin;
Format.eprintf fmt
let x : (('c -> 'c) & ('b -> 'b) & ('a -> 'a)) = fun ('aa -> 'aa; 'bb -> 'bb ; 'cc -> 'cc ) x -> x ;;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment