Skip to content

Commit a2a2554

Browse files
committed
Export a few functions from about that will be used in paths
1 parent dce8767 commit a2a2554

File tree

1 file changed

+24
-20
lines changed

1 file changed

+24
-20
lines changed

HB/about.elpi

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ main-located S (loc-gref GR) :- from Factory Mixin GR, !,
4545
private.main-builder S Factory Mixin.
4646

4747
main-located S (loc-gref GR) :-
48-
std.filter {coq.CS.db-for _ (cs-gref GR)} (private.not1 private.unif-hint?) LV,
48+
std.filter {coq.CS.db-for _ (cs-gref GR)} (not1 unif-hint?) LV,
4949
coq.CS.db-for GR _ LP,
5050
std.filter {coq.coercion.db} (c\c = coercion GR _ _ _) LC,
5151
if (LV = [], LP = [], LC = [])
@@ -57,6 +57,29 @@ main-located S (loc-gref GR) :-
5757

5858
main-located S (loc-abbreviation _) :- coq.error "HB: unknown abbreviation" S.
5959

60+
/* things also used in paths.elpi ------------------------------------------ */
61+
62+
shorten coq.pp.{ v , h, hv, hov , spc , str , box , glue , brk , empty }.
63+
64+
pred bulletize1 i:(A -> coq.pp -> prop), i:A, o:coq.pp.
65+
bulletize1 F X (glue [str "- ", M]) :- F X M.
66+
67+
pred bulletize i:list A, i:(A -> coq.pp -> prop), o:coq.pp.
68+
bulletize [] _ empty.
69+
bulletize L F (glue [brk 0 0 | PLB]) :-
70+
std.map L (bulletize1 F) PL,
71+
std.intersperse (brk 0 0) PL PLB.
72+
73+
% Print shortest qualified identifier of the module containing a gref
74+
pred pp-module i:gref, o:coq.pp.
75+
pp-module GR (str ID) :- gref->modname_short GR "." ID.
76+
77+
pred unif-hint? i:cs-instance.
78+
unif-hint? (cs-instance _ (cs-gref GR) _) :- coq.CS.db-for GR _ [_|_].
79+
80+
pred not1 i:(A -> prop), i:A.
81+
not1 P X :- not (P X).
82+
6083

6184
/* ------------------------------------------------------------------------- */
6285
/* ----------------------------- private code ------------------------------ */
@@ -323,10 +346,6 @@ compute-field-info Names Impls O :-
323346
compute-field-info.aux {std.rev Names} {std.rev Impls} Pp,
324347
std.intersperse spc {std.rev Pp} O.
325348

326-
% Print shortest qualified identifier of the module containing a gref
327-
pred pp-module i:gref, o:coq.pp.
328-
pp-module GR (str ID) :- gref->modname_short GR "." ID.
329-
330349
pred pp-const i:constant, o:coq.pp.
331350
pp-const F (str ID) :- coq.gref->id (const F) ID.
332351

@@ -337,15 +356,6 @@ pred pp-if-verbose o:coq.pp, i:(coq.pp -> prop).
337356
pp-if-verbose V P :- get-option "verbose" tt, !, P V.
338357
pp-if-verbose empty _.
339358

340-
pred bulletize1 i:(A -> coq.pp -> prop), i:A, o:coq.pp.
341-
bulletize1 F X (glue [str "- ", M]) :- F X M.
342-
343-
pred bulletize i:list A, i:(A -> coq.pp -> prop), o:coq.pp.
344-
bulletize [] _ empty.
345-
bulletize L F (glue [brk 0 0 | PLB]) :-
346-
std.map L (bulletize1 F) PL,
347-
std.intersperse (brk 0 0) PL PLB.
348-
349359
pred pp-loc-of i:gref, o:coq.pp.
350360
pp-loc-of GR PP :- decl-location GR Loc, !, pp-loc Loc PP.
351361
pp-loc-of _ coq.pp.empty.
@@ -378,10 +388,4 @@ print-docstring GR :-
378388
(coq.say {coq.pp->string (box (hov 5) [str"Doc: ",Doc])})
379389
true.
380390

381-
pred unif-hint? i:cs-instance.
382-
unif-hint? (cs-instance _ (cs-gref GR) _) :- coq.CS.db-for GR _ [_|_].
383-
384-
pred not1 i:(A -> prop), i:A.
385-
not1 P X :- not (P X).
386-
387391
}}

0 commit comments

Comments
 (0)