You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/source/tutorials/02-handling-emptiness.md
-12Lines changed: 0 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -159,18 +159,6 @@ This demonstrates another critical aspect of `Gen0`: it allows for speculative g
159
159
160
160
---
161
161
162
-
## Congratulations!
163
-
164
-
You can now write safe, robust generators for complex dependent types and are prepared to handle the full range of data-generating scenarios.
165
-
166
-
In this tutorial, you learned how to:
167
-
168
-
* ✅ Identify types that can be uninhabited (empty).
169
-
* ✅ Use `Gen0` to define a generator that might not produce a value.
170
-
* ✅ Use `empty` to explicitly mark a generation path as impossible.
171
-
* ✅ Use `pick` to safely run a `Gen0` and handle the resulting `Maybe` value.
172
-
* ✅ Create filtered generators with `suchThat` and understand why they must also be `Gen0`.
173
-
174
162
## Next Steps
175
163
176
164
Now that you've mastered manual generation for both simple and complex types, it's time to see how `DepTyCheck` can do this work for you automatically.
Copy file name to clipboardExpand all lines: docs/source/tutorials/03-measuring-test-coverage.md
+1-10Lines changed: 1 addition & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -157,16 +157,7 @@ Besides aggregated reports, labels are also an invaluable tool for debugging. Yo
157
157
```
158
158
In the first run, the label `"Red"` was printed to the console the moment the corresponding generator was executed. In the second run, no labels were printed. For a deeply nested generator, this trace allows you to understand exactly which path was taken to produce a specific problematic value.
159
159
160
-
## Congratulations!
161
-
162
-
You can now generate, analyze, and debug your test generators using labels.
163
-
164
-
In this tutorial, you learned how to:
165
-
166
-
* ✅ Use `label` to instrument different paths in your generator.
167
-
* ✅ **Aggregate Constructor Coverage:** Use `initCoverageInfo`, `unGenTryND`, and `registerCoverage` to produce a report on which constructors were hit.
168
-
* ✅ **Debug Single Runs:** Use `PrintAllLabels` with `pick1` to trace the execution of a single generator run.
169
-
* ✅ Understand that runners like `pick1` use a default `IgnoreLabels` implementation that can be overridden with the `@{...}` syntax.
Copy file name to clipboardExpand all lines: docs/source/tutorials/04-automatic-generator-derivation.md
-10Lines changed: 0 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -183,16 +183,6 @@ This powerful pattern allows you to create highly flexible generators that adapt
183
183
184
184
---
185
185
186
-
## Congratulations!
187
-
188
-
You have now unlocked the core power of `DepTyCheck`. You can say goodbye to writing boilerplate generators and let the compiler do the work for you, while still providing guidance when needed.
189
-
190
-
In this tutorial, you learned:
191
-
192
-
* ✅ How to replace a complex, manual recursive generator with a single `deriveGen` macro.
193
-
* ✅ How to provide a **custom generator** for a base type like `String` by adding a `=>` constraint to the signature.
194
-
* ✅ How to pass **runtime arguments** to a derived generator to make it more flexible and context-aware.
195
-
196
186
## Next Steps
197
187
198
188
Now that you know how to automatically generate data and provide hints, you are ready for more advanced topics:
Copy file name to clipboardExpand all lines: docs/source/tutorials/05-derivegen-signatures.md
-12Lines changed: 0 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -150,18 +150,6 @@ Let's combine the patterns we've learned. Our final generator will be the most f
150
150
151
151
---
152
152
153
-
## Congratulations!
154
-
155
-
You have learned to 'speak' to `deriveGen` through its most powerful interface: the type signature. You are no longer just asking it to generate a type; you are giving it a precise blueprint of your intent.
156
-
157
-
By crafting the signature, you can control what `deriveGen` does:
158
-
159
-
* ✅ **Given Parameters (`(n : Nat) -> ...`):** Arguments before `Fuel` are treated as fixed runtime inputs.
160
-
* ✅ **Generated Parameters (`... -> Gen (n ** Vect n a)`):** Using `**` in the return type tells `deriveGen` to invent a value for that parameter for you.
161
-
* ✅ **External Generator Hints (`(...) => ...`):** A constraint tells `deriveGen` to use a generator you provide for a specific type.
162
-
163
-
Mastering these three patterns gives you the power to create flexible, reusable, and precise automatic generators for indexed types like `Vect` and `Fin`.
164
-
165
153
## Next Steps
166
154
167
155
Now that you know how to control `deriveGen` through signatures, you are ready for more advanced topics:
Copy file name to clipboardExpand all lines: docs/source/tutorials/06-beyond-fuel.md
-10Lines changed: 0 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -187,16 +187,6 @@ This is the core optimization: when the type system guarantees termination throu
187
187
188
188
---
189
189
190
-
## Congratulations!
191
-
192
-
You now understand the sophisticated, two-pronged approach `deriveGen` uses to handle recursion safely and efficiently. This knowledge will help you design data types that can be generated more effectively and to reason about the performance of your generators.
193
-
194
-
In this tutorial, you learned:
195
-
196
-
* ✅ **`SpendingFuel` Recursion:** The default behavior for simple recursive types like `PNat` or `List`, where each recursive step consumes one unit of fuel.
197
-
* ✅ **`StructurallyDecreasing` Recursion:** An advanced optimization for indexed types like `Fin` or `Vect`, where `deriveGen` proves termination from type indices and doesn't spend fuel.
198
-
* ✅ **Under the Hood:** How `deriveGen` translates to manual Fuel pattern matching, and why the two recursion types generate different code.
199
-
200
190
## Next Steps
201
191
202
192
Now that you understand how `deriveGen` handles recursion, you are ready for more advanced topics:
Copy file name to clipboardExpand all lines: docs/source/tutorials/07-derivation-tuning.md
-13Lines changed: 0 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -143,19 +143,6 @@ data LtPair : Type where
143
143
144
144
---
145
145
146
-
## Congratulations!
147
-
148
-
You have now learned the true, advanced methods for controlling `DepTyCheck`'s derivation engine. By implementing the tuning interfaces, you can provide expert guidance to the compiler, resulting in efficient and well-distributed test data for any data type.
149
-
150
-
In this tutorial, you learned how to:
151
-
152
-
* ✅ **Prove Bias:** Use coverage analysis to find and prove when a default generator is not producing a good data distribution.
153
-
* ✅ **Tune Probabilities:** Implement the `ProbabilityTuning` interface to fix biases by giving a constructor a new `Weight`.
154
-
* ✅ **Tune Generation Order:** Implement the `GenOrderTuning` interface to tell `deriveGen` which arguments to generate first, making generation for constrained dependent types more efficient.
155
-
* ✅ Use advanced Idris features like `instance` declarations and `Name` literals to apply these tuning rules.
156
-
157
-
This completes the advanced derivation tuning tutorial! You now have the tools to control `deriveGen`'s behavior for any data type.
158
-
159
146
## Next Steps
160
147
161
148
* **Want to integrate handwritten generators?** Continue to **[Mixing Manual and Automatic Generation](09-mixing-manual-and-automatic.md)** to see how `deriveGen` automatically discovers and uses your custom generators.
Copy file name to clipboardExpand all lines: docs/source/tutorials/08-under-the-hood-a-derivegen-like-macro.md
+3-14Lines changed: 3 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -100,11 +100,11 @@ Now we need to create the manager that understands the `Simple` type as a whole.
100
100
-- Get constructor info: B first (non-recursive), then A (recursive)
101
101
let [conB, conA] = sig.targetType.cons
102
102
let emptyGivs = empty -- No given constructor arguments for Simple
103
-
103
+
104
104
-- Get the code for the two constructor bodies using our named strategies
105
105
b_body <- consGenExpr @{MyStrategy} sig conB emptyGivs (var "fuel")
106
106
a_body <- consGenExpr @{MyStrategy} sig conA emptyGivs (var "fuel")
107
-
107
+
108
108
-- Our biased logic!
109
109
let body = `(case fuel of
110
110
Dry => ~b_body -- Out of fuel, MUST choose B
@@ -125,7 +125,7 @@ We have now defined a complete, custom derivation pipeline. All that's left is t
125
125
126
126
## Step 4: Create the Top-Level Macro
127
127
128
-
Users don't interact with `DeriveBodyForType` directly. They use the `deriveGen` macro. The `deriveGen` function takes an optional `@` argument providing the core derivation logic. By default, this is `MainCoreDerivator @{LeastEffort}`.
128
+
Users don't interact with `DeriveBodyForType` directly. They use the `deriveGen` macro. The `deriveGen` function takes an optional `@` argument providing the core derivation logic. By default, this is `MainCoreDerivator @{LeastEffort}`.
129
129
130
130
We will create our own macro, `myDeriveGen`, that simply calls `deriveGen` but passes our custom `MyTypeStrategy` instead.
131
131
@@ -244,17 +244,6 @@ main = do
244
244
245
245
---
246
246
247
-
## Congratulations!
248
-
249
-
You have built a working derivation macro from scratch. You now understand the fundamental architecture of `DepTyCheck`'s derivation engine and have seen that it is not magic, but a well-structured system of extensible interfaces. This is the deepest level of `DepTyCheck` mastery.
250
-
251
-
In this tutorial, you learned:
252
-
253
-
* ✅ The core interfaces of the derivation engine: `DeriveBodyForType` and `DeriveBodyRhsForCon`.
254
-
* ✅ How the "Type Expert" delegates work to "Constructor Experts".
255
-
* ✅ How to implement these interfaces to create a custom derivation strategy.
256
-
* ✅ How to wrap up your custom logic in a top-level macro that acts just like `deriveGen`.
257
-
258
247
## Path to Contribution
259
248
260
249
Understanding these internal APIs is the first step to extending `DepTyCheck`. If you find a new, useful derivation pattern or a more advanced strategy, you now have the foundational knowledge to implement it and contribute back to the project.
Copy file name to clipboardExpand all lines: docs/source/tutorials/09-mixing-manual-and-automatic.md
+1-3Lines changed: 1 addition & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -77,9 +77,7 @@ It works! `deriveGen` automatically found and used our `genSpecialString` functi
77
77
2. **Explicit (`=>` syntax):** As seen in Tutorial 4, you can add a `(Fuel -> Gen MaybeEmpty String) =>` constraint to the signature.
78
78
* **When to use:** This is best when you want to provide a generator for a *primitive* or *built-in* type (like `String`, `Nat`, `List`), or when you want the caller to be able to supply *different* generators in different contexts.
79
79
80
-
## Congratulations!
81
-
82
-
You've learned how to seamlessly mix automatic and manual generation, giving you the perfect balance of convenience and control.
0 commit comments