diff options
author | Pierre-Marie Pédrot <pierre-marie.pedrot@inria.fr> | 2016-04-20 17:24:58 +0200 |
---|---|---|
committer | Pierre-Marie Pédrot <pierre-marie.pedrot@inria.fr> | 2016-05-04 13:47:12 +0200 |
commit | 729d838838d8df06395726477817620e2ae998bc (patch) | |
tree | 50986942f010f2a9281aa19dd715bd1f67dd921e /grammar | |
parent | 4740e82e4af6d38e9cc55dfe1a05db87f73bf1e6 (diff) |
Interpretation function can return any untyped value.
Diffstat (limited to 'grammar')
-rw-r--r-- | grammar/argextend.ml4 | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/grammar/argextend.ml4 b/grammar/argextend.ml4 index 2618e5d89..3b7e180c6 100644 --- a/grammar/argextend.ml4 +++ b/grammar/argextend.ml4 @@ -119,19 +119,21 @@ let declare_tactic_argument loc s (typ, f, g, h) cl = let interp = match f with | None -> begin match globtyp with - | None -> <:expr< fun ist v -> Ftactic.return v >> + | None -> + let typ = match globtyp with None -> ExtraArgType s | Some typ -> typ in + <:expr< fun ist v -> Ftactic.return (Geninterp.Val.inject (Geninterp.val_tag $make_topwit loc typ$) v) >> | Some globtyp -> <:expr< fun ist x -> - Ftactic.bind - (Tacinterp.interp_genarg ist (Genarg.in_gen $make_globwit loc globtyp$ x)) - (fun v -> Ftactic.return (Tacinterp.Value.cast $make_topwit loc globtyp$ v)) >> + Tacinterp.interp_genarg ist (Genarg.in_gen $make_globwit loc globtyp$ x) >> end | Some f -> (** Compatibility layer, TODO: remove me *) + let typ = match globtyp with None -> ExtraArgType s | Some typ -> typ in <:expr< let f = $lid:f$ in fun ist v -> Ftactic.nf_s_enter { Proofview.Goal.s_enter = fun gl -> let (sigma, v) = Tacmach.New.of_old (fun gl -> f ist gl v) gl in + let v = Geninterp.Val.inject (Geninterp.val_tag $make_topwit loc typ$) v in Sigma.Unsafe.of_pair (Ftactic.return v, sigma) } >> in |