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)
(** [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.
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$);
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 =
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$) >>
;;