File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -565,3 +565,30 @@ Elpi Typecheck derive.
565565```
566566
567567So when the user ` Import ` s ` better_std ` he gets a fully loaded ` derive ` .
568+
569+ The code of the derivation must be put in a namespace. So ` myder.elpi ` should
570+ look like so
571+
572+ ``` elpi
573+ namespace derive.myder {
574+
575+ pred main i:gref, i:string, o:list prop.
576+ main GR Prefix Clauses :- std.do! [
577+ ... % synthesize Body and Type
578+ Name is Prefix ^ "myconcept",
579+ coq.ensure-fresh-global-id Name FName,
580+ coq.env.add-const FName Body Type _ C,
581+ Clauses = [myder-done GR, myder GR (const C)],
582+ std.forall Clauses (x\
583+ coq.elpi.accumulate _ "derive.myder.db" (clause _ _ x)
584+ ),
585+ ].
586+
587+ }
588+ ```
589+
590+ It is important that all clauses added to the database are also returned
591+ (see the last argument of ` main ` ). Derive runs all derivations at once
592+ and databases are updated only when the program ends. So derive will
593+ assume, with ` => ` , the clauses generated by one derivation before running the
594+ nest one.
You can’t perform that action at this time.
0 commit comments