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
> 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
+
```
59
60
60
61
### Run your generator
61
62
@@ -105,9 +106,10 @@ Here's what's new:
105
106
106
107
-`choose (18, 99)` creates a recipe for picking a random number in that range.
107
108
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
110
111
generators.
112
+
```
111
113
112
114
- 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"`).
Copy file name to clipboardExpand all lines: docs/source/tutorials/t04-automatic-generator-derivation.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -126,10 +126,10 @@ mutual
126
126
show' (x :: xs) = show x ++ ", " ++ show' xs
127
127
```
128
128
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
132
131
automagic generator deriving supports only `Gen MaybeEmpty` for now. If you need stricter `Gen NonEmpty`, you still need to do it by your hands.
Copy file name to clipboardExpand all lines: docs/source/tutorials/t06-mixing-manual-and-automatic.md
+10-9Lines changed: 10 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -73,14 +73,14 @@ Show User where
73
73
show (MkUser s i) = "MkUser (" ++ show s ++ ") " ++ show i
74
74
```
75
75
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
80
78
explicit `@{genSpecialString}` required!
81
79
80
+
```{note}
82
81
From Idris 2 docs: `%hint` marks functions for auto search, similar to unnamed type class instances. The compiler prioritizes these hints during
83
82
unification when explicit arguments are absent.
83
+
```
84
84
85
85
---
86
86
@@ -97,12 +97,13 @@ genUser : Fuel -> (Fuel -> Gen MaybeEmpty SpecialString) => Gen MaybeEmpty User
97
97
genUser = deriveGen
98
98
```
99
99
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
0 commit comments