Skip to content

Commit 664e1d8

Browse files
committed
fix elaboration of parameters in HB.structure
1 parent f1a7698 commit 664e1d8

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

hb.elpi

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,10 @@ located->gref S [loc-modpath _|_] _ :- coq.error S "should be a factory, but is
116116
located->gref S [loc-modtypath _|_] _ :- coq.error S "should be a factory, but is a module type".
117117
located->gref S [] _ :- coq.error "Could not locate name" S.
118118

119+
pred purge-id i:term, o:term.
120+
purge-id T T1 :-
121+
(pi fresh t v\ copy {{lib:@hb.id lp:t lp:v}} fresh :- !) => copy T T1.
122+
119123
% TODO: generalize/rename when we support parameters
120124
pred argument->gref i:argument, o:gref.
121125
argument->gref (str S) GR :- located->gref S {coq.locate-all S} GR.

structures.v

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,8 @@ sigT->list-w-params {{ lib:@hb.sigT _ lp:{{ fun N Ty B }} }} L C :-
290290
product->triples (B t) (Rest t) C.
291291

292292
main [const-decl Module (some B) _] :- !, std.do! [
293-
sigT->list-w-params B GRFS ClosureCheck, !,
293+
purge-id B B1, std.assert-ok! (coq.elaborate-skeleton B1 _ B2) "illtyped structure definition",
294+
sigT->list-w-params B2 GRFS ClosureCheck, !,
294295
with-attributes (main-declare-structure Module GRFS ClosureCheck),
295296
].
296297
main _ :- coq.error "Usage: HB.structure Definition <ModuleName> := { A of <Factory1> A & … & <FactoryN> A }".

0 commit comments

Comments
 (0)