arrow-optics / arrow.optics.typeclasses / FilterIndex

FilterIndex

interface FilterIndex<S, I, A>

FilterIndex provides a Traversal for a structure S with all its foci A whose index I satisfies a predicate.

Parameters

S - source of Traversal

I - index that uniquely identifies every focus of the Traversal

A - focus that is supposed to be unique for a given pair S and I

Functions

filter abstract fun filter(p: Predicate<I>): Traversal<S, A>
Filter the foci A of a Traversal with the predicate p.

Companion Object Functions

fromIso fun <S, A, I, B> fromIso(FI: FilterIndex<A, I, B>, iso: Iso<S, A>): FilterIndex<S, I, B>
Lift an instance of FilterIndex using an Iso
fromTraverse fun <S, A> fromTraverse(zipWithIndex: (Kind<S, A>) -> Kind<S, Tuple2<A, Int>>, traverse: Traverse<S>): FilterIndex<Kind<S, A>, Int, A>
Create an instance of FilterIndex from a Traverse and a function Kind<S, A>) -> Kind<S, Tuple2<A, Int>>

Inheritors

ListFilterIndex interface ListFilterIndex<A> : FilterIndex<List<A>, Int, A>
FilterIndex instance definition for List.
ListKFilterIndex interface ListKFilterIndex<A> : FilterIndex<ListK<A>, Int, A>
FilterIndex instance definition for ListK.
MapFilterIndex interface MapFilterIndex<K, V> : FilterIndex<Map<K, V>, K, V>
FilterIndex instance definition for Map.
MapKFilterIndex interface MapKFilterIndex<K, V> : FilterIndex<MapK<K, V>, K, V>
FilterIndex instance definition for Map.
NonEmptyListFilterIndex interface NonEmptyListFilterIndex<A> : FilterIndex<NonEmptyList<A>, Int, A>
FilterIndex instance definition for NonEmptyList.
SequenceKFilterIndex interface SequenceKFilterIndex<A> : FilterIndex<SequenceK<A>, Int, A>
FilterIndex instance definition for SequenceK.
StringFilterIndex interface StringFilterIndex : FilterIndex<String, Int, Char>
FilterIndex instance for String. It allows filtering of every Char in a String by its index’s position.

Type Class Hierarchy