Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "coq.env.query-extra-dep" external predicate #525

Merged
merged 4 commits into from
Oct 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add an LPDoc line with something like

-- Extra Dependencies -------------

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 }}.
Loading