Commit 1f58164
feat(zig-api): fix Idris2 0.8 syntax — all 7 ABI modules typecheck clean
Resolved a cluster of Idris2 0.8.0 parser / elaborator restrictions
that prevented the zig-api ABI kernel from type-checking:
- Constructor syntax: `data Foo = MkFoo (x : T)` is invalid in
Idris2 0.8 non-GADT form — changed to positional `data Foo = MkFoo T`
for Handle and Slot.
- `prefix` is a reserved keyword (operator fixity declarations) — renamed
to `pfx` throughout Process.idr, Proofs.idr, and IsSafePath constructor.
- Named explicit args `(prefix : String)` in GADT constructors fail when
the name is a keyword. SafeByPrefix now uses `{pfx : String}` implicit.
- Multi-variable binding `(r s : T)` in function type signatures fails —
split to `(r : T) -> (s : T)` in Types.idr and Proofs.idr.
- Lowercase names in type signatures are auto-bound as implicit vars even
when a global definition exists — Layout.idr now uses literals
(e.g. `Nat.lte 11 255 = True`) instead of named constants.
- `resultTagInjective` rewritten via roundtrip + `justInj` (no Bits8
Uninhabited needed): `decode (encode r) = Just r` gives `Just r = Just s`
from which `justInj` extracts `r = s`.
- `checkSafePath` uses `decEq (isPrefixOf p path) True` (not `if`) so the
proof `checkSafePathHeadMatch` mirrors with `decEq` too.
- `IsLeft`/`IsRight` predicates and their `Uninhabited` instances defined
locally (not in Idris2 0.8 stdlib).
- Added `import Data.List.Elem`, `import Decidable.Equality`,
`import Data.String` where needed.
Result: `idris2 --typecheck zig-api.ipkg` exits 0, all 7 modules pass.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent 10ed787 commit 1f58164
4 files changed
Lines changed: 96 additions & 185 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
15 | 17 | | |
16 | 18 | | |
17 | 19 | | |
| |||
36 | 38 | | |
37 | 39 | | |
38 | 40 | | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
43 | 45 | | |
44 | 46 | | |
45 | 47 | | |
| |||
50 | 52 | | |
51 | 53 | | |
52 | 54 | | |
53 | | - | |
| 55 | + | |
54 | 56 | | |
55 | 57 | | |
56 | 58 | | |
| |||
62 | 64 | | |
63 | 65 | | |
64 | 66 | | |
65 | | - | |
| 67 | + | |
66 | 68 | | |
67 | 69 | | |
68 | 70 | | |
| |||
73 | 75 | | |
74 | 76 | | |
75 | 77 | | |
76 | | - | |
| 78 | + | |
77 | 79 | | |
78 | 80 | | |
79 | 81 | | |
| |||
84 | 86 | | |
85 | 87 | | |
86 | 88 | | |
87 | | - | |
| 89 | + | |
88 | 90 | | |
89 | 91 | | |
90 | 92 | | |
| |||
95 | 97 | | |
96 | 98 | | |
97 | 99 | | |
98 | | - | |
| 100 | + | |
99 | 101 | | |
100 | 102 | | |
101 | 103 | | |
| |||
106 | 108 | | |
107 | 109 | | |
108 | 110 | | |
109 | | - | |
| 111 | + | |
110 | 112 | | |
111 | 113 | | |
112 | 114 | | |
| |||
117 | 119 | | |
118 | 120 | | |
119 | 121 | | |
120 | | - | |
| 122 | + | |
121 | 123 | | |
122 | 124 | | |
123 | 125 | | |
| |||
132 | 134 | | |
133 | 135 | | |
134 | 136 | | |
135 | | - | |
| 137 | + | |
136 | 138 | | |
137 | 139 | | |
138 | 140 | | |
| |||
144 | 146 | | |
145 | 147 | | |
146 | 148 | | |
147 | | - | |
| 149 | + | |
148 | 150 | | |
149 | 151 | | |
150 | 152 | | |
151 | | - | |
| 153 | + | |
152 | 154 | | |
153 | | - | |
| 155 | + | |
154 | 156 | | |
155 | 157 | | |
156 | 158 | | |
| |||
170 | 172 | | |
171 | 173 | | |
172 | 174 | | |
173 | | - | |
| 175 | + | |
174 | 176 | | |
175 | 177 | | |
176 | 178 | | |
177 | | - | |
| 179 | + | |
178 | 180 | | |
179 | | - | |
| 181 | + | |
180 | 182 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
| 16 | + | |
15 | 17 | | |
16 | 18 | | |
17 | 19 | | |
| |||
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
| 26 | + | |
| 27 | + | |
24 | 28 | | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
| 29 | + | |
| 30 | + | |
32 | 31 | | |
33 | 32 | | |
34 | 33 | | |
| |||
38 | 37 | | |
39 | 38 | | |
40 | 39 | | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
48 | 45 | | |
49 | 46 | | |
50 | 47 | | |
| |||
126 | 123 | | |
127 | 124 | | |
128 | 125 | | |
129 | | - | |
130 | | - | |
| 126 | + | |
| 127 | + | |
131 | 128 | | |
132 | 129 | | |
133 | 130 | | |
134 | 131 | | |
135 | 132 | | |
136 | 133 | | |
137 | | - | |
| 134 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
26 | 27 | | |
| 28 | + | |
| 29 | + | |
27 | 30 | | |
28 | 31 | | |
29 | 32 | | |
30 | 33 | | |
31 | 34 | | |
32 | 35 | | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
33 | 53 | | |
34 | 54 | | |
35 | 55 | | |
| |||
54 | 74 | | |
55 | 75 | | |
56 | 76 | | |
57 | | - | |
58 | | - | |
| 77 | + | |
| 78 | + | |
59 | 79 | | |
60 | | - | |
| 80 | + | |
61 | 81 | | |
62 | | - | |
| 82 | + | |
63 | 83 | | |
64 | 84 | | |
65 | | - | |
| 85 | + | |
66 | 86 | | |
67 | | - | |
| 87 | + | |
68 | 88 | | |
69 | 89 | | |
70 | 90 | | |
| |||
104 | 124 | | |
105 | 125 | | |
106 | 126 | | |
107 | | - | |
| 127 | + | |
108 | 128 | | |
109 | 129 | | |
110 | 130 | | |
| |||
138 | 158 | | |
139 | 159 | | |
140 | 160 | | |
141 | | - | |
| 161 | + | |
142 | 162 | | |
143 | | - | |
| 163 | + | |
144 | 164 | | |
145 | 165 | | |
146 | 166 | | |
147 | 167 | | |
148 | 168 | | |
149 | | - | |
150 | | - | |
| 169 | + | |
| 170 | + | |
151 | 171 | | |
152 | | - | |
| 172 | + | |
| 173 | + | |
153 | 174 | | |
154 | 175 | | |
155 | 176 | | |
156 | | - | |
| 177 | + | |
157 | 178 | | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
163 | 184 | | |
164 | 185 | | |
165 | 186 | | |
| |||
193 | 214 | | |
194 | 215 | | |
195 | 216 | | |
| 217 | + | |
196 | 218 | | |
197 | 219 | | |
198 | | - | |
| 220 | + | |
199 | 221 | | |
200 | 222 | | |
201 | 223 | | |
| |||
210 | 232 | | |
211 | 233 | | |
212 | 234 | | |
| 235 | + | |
213 | 236 | | |
214 | 237 | | |
215 | | - | |
| 238 | + | |
216 | 239 | | |
217 | 240 | | |
218 | 241 | | |
219 | | - | |
| 242 | + | |
0 commit comments