Skip to content

Commit b27994a

Browse files
committed
Add a macro to make goal non-abstract
It is useful for tracing unification count and order. Signed-off-by: Dmitrii.Kosarev a.k.a. Kakadu <[email protected]>
1 parent 03c302a commit b27994a

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

config/discover.ml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,16 @@ let discover_logger_flags cfg =
128128
let discover_stats () =
129129
let filename = "instrumentalization.cfg" in
130130
Sys.command (Printf.sprintf "rm -fr '%s'" filename) |> ignore;
131-
try
132-
let _ = Unix.getenv "OCANREN_STATS" in
133-
Cfg.Flags.write_lines filename [ "-D"; "STATS" ]
134-
with Not_found -> Cfg.Flags.write_lines filename []
131+
List.concat
132+
[
133+
(match Unix.getenv "OCANREN_STATS" with
134+
| exception Not_found -> []
135+
| _ -> [ "-D"; "STATS" ]);
136+
(match Unix.getenv "OCANREN_NON_ABSTRACT_GOAL" with
137+
| exception Not_found -> []
138+
| _ -> [ "-D"; "NON_ABSTRACT_GOAL" ]);
139+
]
140+
|> Cfg.Flags.write_lines filename
135141

136142
let discover_docs () =
137143
let filename = "package-doc.cfg" in

src/core/Core.mli

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,13 @@ module State :
2525
type t
2626
end
2727

28+
IFDEF NON_ABSTRACT_GOAL THEN
29+
(** Goal is a function that converts a state into a lazy stream of states. *)
30+
type 'a goal' = State.t -> 'a
31+
ELSE
2832
(** Goal is a function that converts a state into a lazy stream of states. *)
2933
type 'a goal'
34+
END
3035

3136
(** @canonical OCanren.goal *)
3237
type goal = State.t Stream.t goal'

0 commit comments

Comments
 (0)