@@ -1241,13 +1241,20 @@ main-declare-builder (builder _ SrcFactory TgtMixin B) FromClauses MoreFromClaus
12411241 ].
12421242
12431243% [export Module] exports a Module now adds it to the collection of
1244- % modules to export in the end
1244+ % modules to export in the end of the current enclosing module,
1245+ % by the command HB.Exports
1246+
12451247pred to-export o:modpath.
12461248pred export i:modpath.
12471249export Module :- !,
12481250 coq.env.export-module Module,
12491251 acc current (clause _ _ (to-export Module)).
12501252
1253+ pred main-reexport.
1254+ main-reexport :- !,
1255+ std.findall (to-export Module_) Mods,
1256+ std.forall Mods (x\ sigma y\ to-export y = x, coq.env.export-module y).
1257+
12511258pred mk-mixin-fun i:list-w-params mixinname, i:term, o:term.
12521259mk-mixin-fun ML X MLX :- mk-mixin-fun.then ML (p\ t\ body\ body = X) MLX.
12531260
@@ -1673,11 +1680,6 @@ main-declare-structure Module GRFSwP ClosureCheck :- std.do! [
16731680
16741681 coq.env.begin-module "Exports" none,
16751682 declare-sort-coercion Structure SortProjection,
1676- if-verbose (coq.say "HB: exporting operations"),
1677- ClassAlias => ClassRequires => Factories =>
1678- export-operations Structure SortProjection ClassProjection MLwP [] EX MLToExport,
1679- % TODO: issue an Arguments op T : rename, where T is the name written by
1680- % the user in Definition foo := { T of ... }
16811683
16821684 if-verbose (coq.say "HB: exporting unification hints"),
16831685 ClassAlias => ClassRequires => Factories =>
@@ -1693,10 +1695,8 @@ main-declare-structure Module GRFSwP ClosureCheck :- std.do! [
16931695 (coq.say "declare-structure:" ClassName "should be an inductive", fail),
16941696
16951697 if-verbose (coq.say "HB: accumulating various props"),
1696- std.map MLToExport (m\r\ r = mixin-first-class m ClassName) MixinFirstClass,
16971698 std.flatten [
1698- MixinFirstClass, EX, Factories,
1699- [ClassRequires], [ClassAlias], [is-structure Structure],
1699+ Factories, [ClassRequires], [ClassAlias], [is-structure Structure],
17001700 NewJoins, [class-def CurrentClass]
17011701 ]
17021702 NewClauses,
@@ -1711,6 +1711,20 @@ main-declare-structure Module GRFSwP ClosureCheck :- std.do! [
17111711
17121712 export Exports,
17131713
1714+ if-verbose (coq.say "HB: exporting operations"),
1715+ ClassAlias => ClassRequires => Factories =>
1716+ export-operations Structure SortProjection ClassProjection MLwP [] EX MLToExport,
1717+ % TODO: issue an Arguments op T : rename, where T is the name written by
1718+ % the user in Definition foo := { T of ... }
1719+
1720+ if-verbose (coq.say "HB: start operations meta-data module ElpiOperations"),
1721+ ElpiOperationModName is "ElpiOperations" ^ {std.any->string {new_int}},
1722+ coq.env.begin-module ElpiOperationModName none,
1723+ std.map MLToExport (m\r\ r = mixin-first-class m ClassName) MixinFirstClass,
1724+ std.forall {std.append EX MixinFirstClass} (c\ acc current (clause _ _ c)),
1725+ coq.env.end-module ElpiOperations,
1726+ export ElpiOperations,
1727+
17141728 declare-factory-abbrev Module (factory-by-classname ClassName),
17151729
17161730 NewClauses => if-MC-compat (mc-compat-structure Module ModulePath MLToExport {w-params.nparams MLwP} ClassName ClassProjection),
0 commit comments