146 questions
3
votes
1
answer
100
views
Why is the getOrElse() function of arrow-kt returning Any?
I am trying to understand the getOrElse() function of arrow-kt. I want to create a simple function that takes a list of strings, filters them, and returns the first matching value as an Option<...
1
vote
1
answer
104
views
Replacing Arrow's deprecated orElse with getOrElse doesn't work
I'm working on migrating some existing Kotlin code from Arrow 1.x to 2.x. The old code looked something like this:
fun filterStrings(incoming: List<String>): Option<String> = incoming
....
1
vote
1
answer
64
views
Unexpected behavior when replacing arrow-kt partiallyN function with kotlin lambda
I'm working on updating some Kotlin code that depends on arrow-kt. As part of the migration process from arrow 1.2 to 2.x, I need to get rid of arrow partiallyN() functions and replace them with ...
2
votes
1
answer
60
views
Unwrapping an arrow-kt Option in an extension function
I'm in the process of migrating some utility projects our team uses from Arrow 1.2 to 2.x . One of the functions that needs to be updated is an extension function for converting a String into a Date. ...
0
votes
0
answers
88
views
Dependency conflict when upgrading arrow-kt to 1.2.4
I'm currently working on upgrading dependencies for a kotlin project that uses arrow kt. One of the libraries we use is arrow-fx-coroutines. After upgrading to the most recent 1.x version (1.2.4) I am ...
1
vote
1
answer
72
views
What's the difference of the input and output parameters of Arrow's Schedule.doWhile()?
I have seen this example in the Arrow documentation:
import arrow.resilience.Schedule
suspend fun main() {
var result = ""
Schedule
.doWhile<String> { input, ...
1
vote
1
answer
91
views
Map a set of Arrow-KT Either's to a data class
I have came a cross a need to combine multiple Arrow-kt eithers:
Given the following
typealias ApiResult<T> = Either<Exception, T>
interface ApiClient {
fun getUserIds(): ApiResult<...
1
vote
1
answer
66
views
How do I handle logical errors in kotlin arrow
I'm working on a function where there is more than one possible failure path that I need to differentiate between. My paths are
success - return the value
logical error - non-fatal issue that the can ...
0
votes
1
answer
50
views
Type mismatch when accumulating errors with Arrow-Kt
I'm working on a function to process a list of File objects. My plan was to use the 'mapOrAccumulate()' function from Arrow to get the collected errors if one or more files fails to process. However ...
0
votes
1
answer
130
views
Filtering accumulated errors with kotlin arrow
I am working on a kotlin application as part of an AWS-Lambda. The application needs to run some functions and keep track of any errors raised. However, not all error types should result in a failure ...
3
votes
2
answers
339
views
Parsing NonEmptyList directly from JSON
Given this JSON: [{"name": "test"}].
Is there a way I can parse this JSON array directly into an Arrow NonEmptyList?
My background is Scala and I'm exploring Ktor + Arrow.
I have ...
0
votes
1
answer
267
views
Safely closing an input stream using Kotlin and Arrow
I'm working on an application that uses the arrow-kt library of Kotlin to execute some code as part of an AWS lambda. The function takes an InputStream as a parameter. It then needs to convert that ...
4
votes
1
answer
213
views
Not enough information to infer type argument for 'Error' using Raise context receiver since Kotlin 2.0.0-Beta3
Since Kotlin 2.0.0-RC1 was recently released, I decided to prepare my codebase for the 2.0 upgrade and faced unexpected compilation issue in places where "context receivers" was used.
...
0
votes
1
answer
490
views
Need help understanding mapOrAccumulate() in Kotlin Arrow
I'm working on some code using Kotlin and arrow-kt that repeatedly calls a function and collects the results. I found a function in arrow-core called mapOrAccumulate() that seems like the correct tool ...
0
votes
1
answer
87
views
Building a collection of function outcomes using Kotlin and Arrow without using a mutable collection
I have a bit of a tricky problem. I have a Kotlin function that takes in three collections of data representing items that need to be 'deleted', 'updated', or 'added'. For each of those three datasets,...