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
/**
* [OptionalGetter] to itself if it satisfies the predicate.
*
* Select all the elements which satisfy the predicate.
*
* ```kotlin
* import arrow.optics.Traversal
* import arrow.optics.Optional
*
* val positiveNumbers = Traversal.list<Int>() compose OptionalGetter.filter { it >= 0 }
*
* positiveNumbers.getAll(listOf(1, 2, -3, 4, -5)) == listOf(1, 2, 4)
* ```
*/
The issue I am facing is that Traversal.list<Int>() compose OptionalGetter.filter { it >= 0 } doesn't compile:
ype mismatch: inferred type is OptionalGetter<???, ???> /* = POptionalGetter<???, ???, ???> */ but PTraversal<in Int, out Int, out TypeVariable(C), in TypeVariable(D)> was expected
Type mismatch: inferred type is (???) -> Unit but (???) -> Boolean was expected
Type mismatch: inferred type is Unit but Boolean was expected
At the moment I am struggling to find examples on how to zoom into a particular element in the list. My use-case is a data class A with a property b: List<B>, and given A, I want to make a change to B.someProperty, but only for a list element that satisfies some condition. Help would be appreciated.
The text was updated successfully, but these errors were encountered:
What version are you currently using? 1.2.0
What would you like to see?
OptionalGetter.filter
has the following javadoc:The issue I am facing is that
Traversal.list<Int>() compose OptionalGetter.filter { it >= 0 }
doesn't compile:At the moment I am struggling to find examples on how to zoom into a particular element in the list. My use-case is a data class
A
with a propertyb: List<B>
, and givenA
, I want to make a change toB.someProperty
, but only for a list element that satisfies some condition. Help would be appreciated.The text was updated successfully, but these errors were encountered: