Skip to content
Snippets Groups Projects
Commit 5dda93a3 authored by Richard W.M. Jones's avatar Richard W.M. Jones
Browse files

Pass a suspension to 'require'.

parent bb4a32c1
No related branches found
No related tags found
No related merge requests found
......@@ -35,7 +35,7 @@ let target v =
if v then raise (Goal_result Goal_OK)
let target_all vs = target (List.fold_left (&&) true vs)
let target_exists vs = target (List.fold_left (||) false vs)
let require () = ()
let require f = f ()
type period_t = Seconds | Days | Months | Years
let seconds = (1, Seconds)
......
......@@ -100,7 +100,7 @@ val target_exists : bool list -> unit
(** [target_exists [t1; t2; ...]] is the same as writing
[target (t1 || t2 || ...)] *)
val require : unit -> unit
val require : (unit -> unit) -> unit
(** [require] {!goal} defines the requirements of this rule, that
is, other goals that have to be met before this rule is able to run.
......
......@@ -111,7 +111,7 @@ let generate_let_goal _loc (r : rec_flag) (lets : binding) =
let () = publish $str:name$ (
function
| [] ->
Goaljobs.require ($lid:gname$ ())
Goaljobs.require $lid:gname$
| _ ->
failwith (Printf.sprintf "goal '%s' does not take any arguments"
$str:name$);
......@@ -120,7 +120,7 @@ let generate_let_goal _loc (r : rec_flag) (lets : binding) =
StSem (_loc, stmt, publish_name)
) stmts !autopublish
(* Rewrite 'require (name args...)' as 'require (goal_name args)'.
(* Rewrite 'require (name args...)' as 'require (fun () -> goal_name args)'.
* 'expr' is a function call.
*)
let generate_require _loc expr =
......@@ -137,7 +137,7 @@ let generate_require _loc expr =
locfail _loc "require (...) expression must contain a call to a goal"
in
let expr = rewrite expr in
<:expr< Goaljobs.require ($expr$) >>
<:expr< Goaljobs.require (fun () -> $expr$) >>
;;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment