Skip to content

Commit 801ea8d

Browse files
committed
[ docs ] Update note for tutorials, remove useless index
1 parent 1dcfe4b commit 801ea8d

14 files changed

Lines changed: 143 additions & 249 deletions

docs/source/tutorials.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ You can read more in the `original framework <https://diataxis.fr/tutorials/>`_
1414
:maxdepth: 1
1515
:caption: Choose what to learn
1616

17-
tutorials/index
1817
tutorials/t00-installation-and-setup
1918
tutorials/t01-generator-monad
2019
tutorials/t02-handling-emptiness
@@ -25,5 +24,10 @@ You can read more in the `original framework <https://diataxis.fr/tutorials/>`_
2524
tutorials/t07-beyond-fuel
2625
tutorials/t08-generating-gadts-with-proofs
2726
tutorials/t09-toy-example
27+
28+
.. toctree::
29+
:maxdepth: 1
30+
:caption: Enjoy your curiosity
31+
2832
tutorials/t10-derivation-tuning
2933
tutorials/t11-under-the-hood-a-derivegen-like-macro

docs/source/tutorials/index.md

Lines changed: 0 additions & 112 deletions
This file was deleted.

docs/source/tutorials/t00-installation-and-setup.md

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@ Expected output:
3838
0.8.x
3939
```
4040

41-
> [!NOTE]\
42-
> You need Idris 2 version **0.8.0 or newer** for DepTyCheck to work.
41+
```{note}
42+
You need Idris 2 version **0.8.0 or newer** for DepTyCheck to work.
43+
```
4344

4445
---
4546

@@ -59,8 +60,9 @@ pack update-db
5960
pack install deptycheck
6061
```
6162

62-
> [!NOTE]\
63-
> This command downloads and builds DepTyCheck. It may take a few minutes the first time.
63+
```{note}
64+
This command downloads and builds DepTyCheck. It may take a few minutes the first time.
65+
```
6466

6567
---
6668

@@ -88,8 +90,9 @@ modules = Main
8890
depends = deptycheck
8991
```
9092

91-
> [!NOTE]\
92-
> The `depends = deptycheck` line tells Idris to use the DepTyCheck library.
93+
```{note}
94+
The `depends = deptycheck` line tells Idris to use the DepTyCheck library.
95+
```
9396

9497
---
9598

@@ -118,11 +121,11 @@ main = do
118121
printLn light
119122
```
120123

121-
> [!NOTE]\
122-
>
123-
> - `%language ElabReflection` enables the metaprogramming features needed for `deriveGen`
124-
> - `deriveGen` automatically creates a generator for `TrafficLight`
125-
> - `pick` runs the generator and extracts one value
124+
```{note}
125+
- `%language ElabReflection` enables the metaprogramming features needed for `deriveGen`
126+
- `deriveGen` automatically creates a generator for `TrafficLight`
127+
- `pick` runs the generator and extracts one value
128+
```
126129

127130
---
128131

@@ -134,13 +137,6 @@ main = do
134137
pack build tutorial
135138
```
136139

137-
Expected output:
138-
139-
```text
140-
Building tutorial...
141-
Build succeeded
142-
```
143-
144140
### Run the executable
145141

146142
```bash
@@ -153,8 +149,9 @@ Expected output (your result will vary):
153149
Yellow
154150
```
155151

156-
> [!NOTE]\
157-
> Run the command multiple times to see different results (Yellow, Green, Red).
152+
```{note}
153+
Run the command multiple times to see different results (Yellow, Green, Red).
154+
```
158155

159156
---
160157

docs/source/tutorials/t01-generator-monad.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,10 @@ genConstantUser : Gen1 UserProfile
5353
genConstantUser = pure (MkProfile "Alice" 30)
5454
```
5555

56-
> [!NOTE]\
57-
> The `pure` function creates the simplest possible "recipe": one that always returns the exact value you give it. The type `Gen1` means this generator
58-
> is guaranteed to produce a value.
56+
```{note}
57+
The `pure` function creates the simplest possible "recipe": one that always returns the exact value you give it. The type `Gen1` means this generator
58+
is guaranteed to produce a value.
59+
```
5960

6061
### Run your generator
6162

@@ -105,9 +106,10 @@ Here's what's new:
105106

106107
- `choose (18, 99)` creates a recipe for picking a random number in that range.
107108

108-
> [!NOTE]\
109-
> The `choose` function randomly picks between two generators with equal probability (50/50). This gives you a simple way to add variation to your
109+
```{note}
110+
The `choose` function randomly picks between two generators with equal probability (50/50). This gives you a simple way to add variation to your
110111
generators.
112+
```
111113

112114
- The `<$>` operator takes the result from the recipe on the right (our random number) and feeds it into the function on the left (`MkProfile "Alice"`).
113115

docs/source/tutorials/t02-handling-emptiness.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,10 @@ case, what can we do?
5151

5252
The type is `Gen1 (Fin 0)`, but `Fin 0` has no values. We can't use `pure` because we don't have a value to give it. We're stuck.
5353

54-
> [!NOTE]
55-
> The `Gen0` emptiness flag indicates this generator might fail to produce a value. Use it for types that may not have inhabitants (like `Fin 0`).
54+
```{note}
55+
The `Gen0` emptiness flag indicates this generator might fail to produce a value. Use it for types that may not have inhabitants (like `Fin 0`).
5656
This is the problem `DepTyCheck` is designed to solve. We need a way to tell the system that a generator is _intentionally_ empty.
57+
```
5758

5859
---
5960

@@ -79,8 +80,9 @@ The changes are small but critical:
7980

8081
- The return type is now `Gen0 (Fin n)`, which signals that the result may be empty.
8182

82-
> [!NOTE]
83-
> The `empty` generator fails immediately. Combined with `pick`, it lets you express "try A, and if it fails, try B" logic without explicit branching.
83+
```{note}
84+
The `empty` generator fails immediately. Combined with `pick`, it lets you express "try A, and if it fails, try B" logic without explicit branching.
85+
```
8486

8587
- In the `Z` case, we can now simply return `empty`. This correctly tells `DepTyCheck` that the recipe for `Fin 0` produces nothing.
8688

docs/source/tutorials/t03-measuring-test-coverage.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,13 @@ generator.
7171
2. Collect Data: Run the generator many times and collect the raw `ModelCoverage` (the label counts) from each individual run.
7272
3. Analyze Results: Fold the collected raw data into the report template to produce the final, printable `CoverageGenInfo`.
7373

74-
> [!NOTE]\
75-
> Coverage measurement happens in three phases:
76-
>
77-
> 1. Generate many samples with different random seeds
78-
> 2. Track which constructors appear
79-
> 3. Report how much every constructor had been called
74+
```{note}
75+
Coverage measurement happens in three phases:
76+
77+
1. Generate many samples with different random seeds
78+
2. Track which constructors appear
79+
3. Report how much every constructor had been called
80+
```
8081

8182
Here is how to implement this in a `main` function.
8283

docs/source/tutorials/t04-automatic-generator-derivation.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,10 @@ mutual
126126
show' (x :: xs) = show x ++ ", " ++ show' xs
127127
```
128128

129-
> [!NOTE]
130-
>
131-
> The latest version of DepTyCheck supports polymorphic specialization for automatically derived generators, but its support is still experimental. Also
129+
```{note}
130+
The latest version of DepTyCheck supports polymorphic specialization for automatically derived generators, but its support is still experimental. Also
132131
automagic generator deriving supports only `Gen MaybeEmpty` for now. If you need stricter `Gen NonEmpty`, you still need to do it by your hands.
132+
```
133133

134134
### Define the generator
135135

docs/source/tutorials/t06-mixing-manual-and-automatic.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,14 @@ Show User where
7373
show (MkUser s i) = "MkUser (" ++ show s ++ ") " ++ show i
7474
```
7575

76-
> [!NOTE]\
77-
>
78-
> - Signature `Gen MaybeEmpty SpecialString` (no `Fuel ->`) is used for manually defined generators
79-
> - The `%hint` pragma marks `genSpecialString` for **auto-implicit search** in Idris 2. It makes this function a candidate for automatic insertion - no
76+
- Signature `Gen MaybeEmpty SpecialString` (no `Fuel ->`) is used for manually defined generators
77+
- The `%hint` pragma marks `genSpecialString` for **auto-implicit search** in Idris 2. It makes this function a candidate for automatic insertion - no
8078
explicit `@{genSpecialString}` required!
8179

80+
```{note}
8281
From Idris 2 docs: `%hint` marks functions for auto search, similar to unnamed type class instances. The compiler prioritizes these hints during
8382
unification when explicit arguments are absent.
83+
```
8484

8585
---
8686

@@ -97,12 +97,13 @@ genUser : Fuel -> (Fuel -> Gen MaybeEmpty SpecialString) => Gen MaybeEmpty User
9797
genUser = deriveGen
9898
```
9999

100-
> [!NOTE]\
101-
>
102-
> - Automatic derivation by `deriveGen` requires `Fuel ->`
103-
> - The constraint `(Fuel -> Gen MaybeEmpty SpecialString) =>` tells `deriveGen` it needs a generator for `SpecialString`
104-
> - Normally, you'd pass it explicitly: `genUser @{genSpecialString} fuel`. But `%hint` enables automatic resolution - Idris finds and inserts
100+
- Automatic derivation by `deriveGen` requires `Fuel ->`
101+
- The constraint `(Fuel -> Gen MaybeEmpty SpecialString) =>` tells `deriveGen` it needs a generator for `SpecialString`
102+
103+
```{note}
104+
Normally, you'd pass it explicitly: `genUser @{genSpecialString} fuel`. But `%hint` enables automatic resolution - Idris finds and inserts
105105
`genSpecialString` automatically!
106+
```
106107

107108
---
108109

docs/source/tutorials/t07-beyond-fuel.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,9 @@ genPNat' (More f) = frequency
187187
]
188188
```
189189

190-
> [!NOTE]
191-
>
192-
> When generating `PS`, we call `genPNat' f` — we pass the **smaller** fuel value. Each recursive step consumes one unit of fuel.
190+
```{note}
191+
When generating `PS`, we call `genPNat' f` — we pass the **smaller** fuel value. Each recursive step consumes one unit of fuel.
192+
```
193193

194194
### StructurallyDecreasing: Manual Implementation
195195

@@ -203,9 +203,9 @@ genFin' (S k) fuel = frequency
203203
, (1, FS <$> genFin' k fuel) ] -- Recursive: SAME fuel!
204204
```
205205

206-
> [!NOTE]
207-
>
208-
> When generating `FS`, we call `genFin' k fuel` — with the **same** fuel value!
206+
```{note}
207+
When generating `FS`, we call `genFin' k fuel` — with the **same** fuel value!
208+
```
209209

210210
Why is this safe? Because the **type index** decreases (`S k``k`), guaranteeing termination even without
211211
spending fuel. The index itself acts as the termination measure.

docs/source/tutorials/t08-generating-gadts-with-proofs.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,10 @@ The `SCons` constructor has an **auto-implicit** argument `{auto prf : isSorted
5353
- To construct an `SCons`, Idris must find a proof that the list is sorted.
5454
- The `auto` keyword tells Idris to search for this proof automatically.
5555

56-
> [!NOTE]\
57-
> The `{auto prf : isSorted ...}` constraint ensures only sorted lists are generated. The `auto` keyword makes Idris search for proof automatically
56+
```{note}
57+
The `{auto prf : isSorted ...}` constraint ensures only sorted lists are generated. The `auto` keyword makes Idris search for proof automatically
5858
during generation.
59+
```
5960

6061
---
6162

@@ -133,12 +134,13 @@ When `deriveGen` encounters `{auto prf : So $ isSorted (x :: toList xs)}`, it:
133134
3. **Checks the constraint**: Is `x <= head xs` (or `x` can be anything if `xs` is empty)?
134135
4. **Backtracks if needed**: If the constraint fails, it tries another `x`
135136

136-
> [!NOTE]\
137-
> The proof argument guarantees sortedness by construction:
138-
>
139-
> - `SNil` is always sorted (base case)
140-
> - `SCons` requires proof that new element maintains order
141-
> - Invalid constructions are rejected at compile time
137+
```{note}
138+
The proof argument guarantees sortedness by construction:
139+
140+
- `SNil` is always sorted (base case)
141+
- `SCons` requires proof that new element maintains order
142+
- Invalid constructions are rejected at compile time
143+
```
142144

143145
This is why the generator may be slower for complex constraints — it may need multiple attempts to find valid values.
144146

0 commit comments

Comments
 (0)