Skip to content

Commit f638963

Browse files
committed
saturate: honor #[export]
1 parent cc82797 commit f638963

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

HB/instance.elpi

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ mk-factory-sort-factory AliasGR CFL CSL :- std.do! [
250250
].
251251

252252
% create instances for all possible combinations of types and structure compatible
253-
func saturate-instances cs-pattern ->.
253+
func saturate-instances cs-pattern -> .
254254
saturate-instances Filter :- std.do! [
255255

256256
findall-has-mixin-instance Filter ClausesHas,
@@ -265,7 +265,11 @@ saturate-instances Filter :- std.do! [
265265

266266
Clauses => std.forall2 TL UKL (t\k\sigma Classes\
267267
std.filter AllClasses (no-instance-for k) Classes,
268-
declare-all-on-type-constructor t Classes _),
268+
declare-all-on-type-constructor t Classes CI),
269+
270+
clauses-for-export CI ClausesExport,
271+
272+
acc-clauses ClausesExport,
269273
].
270274

271275
func no-instance-for cs-pattern, hbclass ->.
@@ -293,11 +297,15 @@ declare-instance Factory T F Clauses CFL CSL :-
293297
T F TheFactory FGR Clauses CFL CSL.
294298
declare-instance Factory T F Clauses CFL CSL :-
295299
declare-canonical-instances-from-factory Factory T F Clauses1 CFL CSL,
296-
if (get-option "export" tt)
300+
clauses-for-export {std.append CFL CSL} Clauses2,
301+
std.append Clauses1 Clauses2 Clauses.
302+
303+
func clauses-for-export list (pair id constant) -> list prop.
304+
clauses-for-export CL ECL :-
305+
if (get-option "export" tt)
297306
(coq.env.current-library File,
298-
std.map {std.append CFL CSL} (x\r\ sigma i c\ x = pr i c, r = instance-to-export File i c) Clauses2)
299-
(Clauses2 = []),
300-
std.append Clauses1 Clauses2 Clauses.
307+
std.map CL (x\r\ sigma i c\ x = pr i c, r = instance-to-export File i c) ECL)
308+
(ECL = []).
301309

302310
% [add-mixin T F _ M Cl] adds a constant being the mixin instance for M on type
303311
% T built from factory F

0 commit comments

Comments
 (0)