| 1 | |
| 2 | let o = open_out "main.out" |
| 3 | |
| 4 | let observe x = |
| 5 | let open Classes in |
| 6 | let open Event in |
| 7 | let open Typeclasses in |
| 8 | let open Hints in |
| 9 | let p = Pp.string_of_ppcmds in |
| 10 | match x with |
| 11 | | NewClass { cl_impl } -> |
| 12 | Printf.fprintf o "NewClass %s\n" (p (Printer.pr_global cl_impl)) |
| 13 | | NewInstance { instance ; info = { hint_priority }; locality } -> |
| 14 | Printf.fprintf o "NewInstance %s %s %s\n" |
| 15 | (p (Printer.pr_global instance)) |
| 16 | (p (Pp.pr_opt Pp.int hint_priority)) |
| 17 | (if locality = Local then "local" else "") |
| 18 | |
| 19 | let obs = Classes.register_observer ~name:"test observer" observe |
| 20 | |
| 21 | let () = Classes.activate_observer obs |