File tree Expand file tree Collapse file tree 2 files changed +67
-0
lines changed
rescript-ecosystem/ppx-proven-record Expand file tree Collapse file tree 2 files changed +67
-0
lines changed Original file line number Diff line number Diff line change 1+ // SPDX-License-Identifier: PMPL-1.0-or-later
2+ = ppx-proven-record
3+ Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>
4+
5+ ReScript PPX for verified record subset destructuring.
6+
7+ == Usage
8+
9+ [source,rescript]
10+ ----
11+ @rest let { className, ?children, ...otherProps } = props
12+ ----
13+
14+ Expands at compile time to explicit field extraction with a typed remainder.
15+
16+ == How It Works
17+
18+ The PPX implements the `computeComplement` algorithm from `proven/SafeRecord`,
19+ which is formally verified in Idris2 to produce exhaustive, disjoint partitions.
20+ The PPX is a direct transliteration — it does not call Idris2 at runtime, but
21+ implements the same algorithm the proofs guarantee correct.
22+
23+ == Formal Foundation
24+
25+ * Idris2 proofs: `proven/src/Proven/SafeRecord/`
26+ * Paper: `proven/docs/papers/safe-record-destructuring.adoc`
27+ * Ephapax linear spec: `nextgen-languages/ephapax/` (future)
28+
29+ == Build
30+
31+ [source,bash]
32+ ----
33+ # The PPX is an OCaml binary (ReScript PPX convention)
34+ dune build
35+ ----
36+
37+ == Status
38+
39+ Scaffolded. Implementation pending.
Original file line number Diff line number Diff line change 1+ (* SPDX-License-Identifier: PMPL-1.0-or-later *)
2+ (* Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath) <j.d.a.jewell@open.ac.uk> *)
3+ (*
4+ * ppx_proven_record — ReScript PPX for verified record subset destructuring.
5+ *
6+ * Transforms:
7+ * @rest let { className, ?children, ...otherProps } = props
8+ *
9+ * Into:
10+ * let className = props.className
11+ * let children = props.children
12+ * let otherProps = { onClick: props.onClick, style: props.style, ... }
13+ *
14+ * The algorithm is a direct transliteration of computeComplement from
15+ * proven/src/Proven/SafeRecord/Proofs.idr, which is formally verified
16+ * to produce exhaustive, disjoint partitions.
17+ *
18+ * Status: Scaffold — implementation pending.
19+ *)
20+
21+ (* TODO: Implement the PPX transformation using ppxlib *)
22+ (* Key steps:
23+ * 1. Find @rest attributes on let bindings
24+ * 2. Extract the requested field names from the pattern
25+ * 3. Look up the record type from the type environment
26+ * 4. Compute the complement (remaining fields)
27+ * 5. Generate explicit destructuring code
28+ *)
You can’t perform that action at this time.
0 commit comments