Ltac2_plugin.Tac2valValues are represented in a way similar to OCaml, i.e. they contrast immediate integers (integers, constructors without arguments) and structured blocks (tuples, arrays, constructors with arguments), as well as a few other base cases, namely closures, strings, named constructors, and dynamic type coming from the Rocq implementation.
type valexpr = | ValInt of int | (* Immediate integers *) |
| ValBlk of tag * valexpr array | (* Structured blocks *) |
| ValStr of Stdlib.Bytes.t | (* Strings *) |
| ValCls of closure | (* Closures *) |
| ValOpn of Names.KerName.t * valexpr array | (* Open constructors *) |
| ValExt : 'a Tac2dyn.Val.tag * 'a -> valexpr | (* Arbitrary data *) |
module Valexpr : sig ... endClosures
val arity_one : (valexpr -> valexpr Proofview.tactic) arityThe arrows in 'v should be pure. Use tclLIFT or do tclUNIT () >>= fun () -> f args when you need effects.
val annotate_closure : Tac2expr.frame -> closure -> closureThe closure must not be already annotated
val purify_closure : 'v arity -> 'v -> 'vFor internal use (Tac2externals). Wraps the applications of the 'v argument to make it pure.
val apply : closure -> valexpr list -> valexpr Proofview.tacticGiven a closure, apply it to some arguments. Handling of argument mismatches is done automatically, i.e. in case of over or under-application.
val apply_val : valexpr -> valexpr list -> valexpr Proofview.tacticComposition of to_closure and apply
val abstract : int -> (valexpr list -> valexpr Proofview.tactic) -> closureTurn a fixed-arity function into a closure. The inner function is guaranteed to be applied to a list whose size is the integer argument.