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
`FilterIndex` provides a [Traversal]({{ '/docs/optics/traversal' | relative_url }}) that can see into a structure `S` and get, set or modify 0 to N foci whose index `I` satisfies a predicate.
9
+
`FilterIndex` provides a [Traversal]({{ '/docs/optics/traversal' | relative_url }}) that can focus into a structure `S` and get, set or modify 0 to N foci whose index `I` satisfies a predicate.
10
10
11
11
If for a structure `S` the foci `A` can be indexed by `I` then a `Traversal` can be created by `FilterIndex` that is filtered by a predicate on `I`.
12
12
@@ -33,7 +33,7 @@ val filter: Traversal<ListKWKind<String>, String> = filterIndexStringByIndex.fil
Arrow provides `FilterIndex` instances for some of its datatypes that can be filtered by index, like `ListKW` and `MapKW`. You can look them up by calling `FilterIndex.filterIndex()`.
36
+
Arrow provides `FilterIndex` instances for some common datatypes both in Arrow and the Kotlin stdlib that can be filtered by index, like `ListKW` and `MapKW`. You can look them up by calling `FilterIndex.filterIndex()`.
37
37
38
38
```kotlin:ank
39
39
FilterIndex.filterIndex<ListKWKind<Int>, Int, Int> { index -> index % 2 == 0 }
Arrow provides `Index` instances for some common datatypes both in Arrow and the Kotlin stdlib that can be indexed, like `ListKW` and `MapKW`.
34
+
You can look them up by calling `Index.index()`.
35
+
36
+
You may create instances of `Index` for your own datatypes which you will be able to use as demonstrated in the [example](#example) above.
37
+
38
+
See [Deriving and creating custom typeclass]({{ '/docs/patterns/glossary' | relative_url }}) to provide your own `Index` instances for custom datatypes.
39
+
40
+
### Instances
41
+
42
+
The following datatypes in Arrow provide instances that adhere to the `Index` typeclass.
0 commit comments