Skip to content

Commit

Permalink
Merge pull request #525 from phikal/query-extra-dep
Browse files Browse the repository at this point in the history
Add "coq.extra-dep" external predicate
  • Loading branch information
gares authored Oct 22, 2023
2 parents c865bcf + c269f48 commit a6d325c
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Requires Elpi 1.16.5 and Coq 8.18.
- Change `coq.ltac.call-ltac1` now accepts either a string (tactic name) or
a tactic expression (of type `ltac1-tactic`)
- New `ltac_tactic:(...)` syntax to pass tactic expressions to Elpi tactics
- New `coq.extra-dep` predicate

## [1.19.1] - 30/08/2023

Expand Down
1 change: 1 addition & 0 deletions _CoqProject.test
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,4 @@ tests/test_link_order_import0.v
tests/test_link_order_import1.v
tests/test_link_order_import2.v
tests/test_link_order_import3.v
tests/test_query_extra_dep.v
6 changes: 6 additions & 0 deletions coq-builtin.elpi
Original file line number Diff line number Diff line change
Expand Up @@ -1666,6 +1666,12 @@ external pred coq.term->string i:term, o:string.
% - @holes! (default: false, prints evars as _)
external pred coq.term->pp i:term, o:coq.pp.

% -- Extra Dependencies -----------------------------------------------

% [coq.extra-dep Identifier FileName] Resolve the file name of an extra
% dependency. See also Coq's From xxx Extra Dependency yyy as zzz.
external pred coq.extra-dep i:id, o:option id.

% -- Access to Elpi's data --------------------------------------------

% clauses
Expand Down
11 changes: 11 additions & 0 deletions src/coq_elpi_builtins.ml
Original file line number Diff line number Diff line change
Expand Up @@ -3884,6 +3884,17 @@ Supported attributes:
state, !: s, [])),
DocAbove);

LPDoc "-- Extra Dependencies -----------------------------------------------";

MLCode(Pred("coq.extra-dep",
In(id, "Identifier",
Out(option id, "FileName",
Easy "Resolve the file name of an extra dependency. See also Coq's From xxx Extra Dependency yyy as zzz.")),
(fun id _ ~depth ->
!: (try Some (ComExtraDeps.query_extra_dep (Names.Id.of_string id))
with Not_found -> None))),
DocAbove);

LPDoc "-- Access to Elpi's data --------------------------------------------";

(* Self modification *)
Expand Down
9 changes: 9 additions & 0 deletions tests/test_query_extra_dep.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
From elpi Require Import elpi.

From unreleased Extra Dependency "elpi_elaborator.elpi" as elab.

Elpi Command test.

Elpi Query lp:{{ coq.extra-dep "elab" (some P) }}.

Elpi Query lp:{{ coq.extra-dep "foo" none }}.

0 comments on commit a6d325c

Please sign in to comment.