Questions tagged [arrow-kt]

Λrrow is a library for Typed Functional Programming in Kotlin

Related to the Arrow library for Kotlin. https://arrow-kt.io/

129 questions
0
votes
1 answer

Can't bind when accumulating errors into a Nel using Arrow 1.2.0 parZipOrAccumulate

I'm using the new parZipOrAccumulate function from Arrow 1.2.0-RC to parallelize two calls and accumulate their errors if any: private suspend fun getUser(legalId: UserLegalId): Either private suspend fun…
codependent
  • 23,193
  • 31
  • 166
  • 308
0
votes
0 answers

LiveData not captured when unit testing Either.fold()

I'm trying to add unit tests to a project that we've inherited from another company, but I can't manage to make them work since I'm not very experienced with testing and I never used the Arrow-kt library. The function…
0
votes
1 answer

How to flatten Arrow-KT's either and Kotlin Coroutines' Flow

I've been using Arrow-KT for a long time now. I'm much newer to coroutines and the programming model around them, this is my first project using them. I've got the following scenario: Either.catch { funcThatReturnsFlow() } .map { flow -> …
craigmiller160
  • 5,751
  • 9
  • 41
  • 75
0
votes
1 answer

How to create a member variable of Arrow Atomic in kotlin

Arrow-fx has a type Atomic which is similar to java AtomicRef but with an initial value, which means I don't need to check every time while accessing the atomic value whether it's null. Here is a simple example import arrow.fx.coroutines.* suspend…
Vencat
  • 1,272
  • 11
  • 36
0
votes
1 answer

How to create an alias to bind method in Arrow-kt?

In Arrow-kt I'd like to create an alias to the bind() - for a kind of custom lib to use Arrow. I'd expect the following to work but it doesn't: suspend fun Either.bindMy(): S = this.bind() The method I wanna target is public interface…
Rolintocour
  • 2,934
  • 4
  • 32
  • 63
0
votes
2 answers

Kotlin + Arrow-kt - why are my coroutines not cancelling properly?

I am using Kotlin together with Arrow-Kt libraries. I am launching on a specific scope some coroutines that make use of Arrow-kt's Schedule. At a certain time, I want to be able to cancel all those coroutines that were launched on that scope, but…
LeYAUable
  • 1,613
  • 2
  • 15
  • 30
0
votes
1 answer

Arrow Analysis throws "NosuchMethod" exception

I'm trying to use arrow analysis in my project to catch exceptions at compile time. I follow this page but when I do Gradle build I get a bunch of runtime exceptions It's my test code fun main() { val wrong = emptyList().get(2) } It's my…
Vencat
  • 1,272
  • 11
  • 36
0
votes
1 answer

Arrow.kt loading state

I used arrow.kt library so many times, I really enjoyed the features they gave to extend kotlin. I like how Either can represent the success/failed states seamlessly. I am just wondering if arrow.kt has a way to represent loading state along…
FarBen
  • 95
  • 1
  • 8
0
votes
2 answers

Closing (Auto)Closeables that exist only in `Either`

I currently face the problem of correctly closing resources that never leave their containing Either. The relevant code looks something like this: object SomeError class MyRes : AutoCloseable { [...] } fun createRes(): Either {…
Kolja
  • 1,197
  • 9
  • 17
0
votes
1 answer

Access a shadowed receiver

I would like to combine a Kotlin extension function on some receiver class Receiver with arrow-kt's either comprehension. In a regular Kotlin extension function, this binds to the receiver object; however, the either-comprehension EitherEffect…
Ulrich Schuster
  • 1,670
  • 15
  • 24
0
votes
2 answers

how to configure ksp in my android gradle groovy dsl build files

im investigating the io.arrow.kt functional programming library in my current android project. im having difficulty in configuring the optics module that employs ksp for source code generation my project gradle resembles this buildscript { …
Hector
  • 4,016
  • 21
  • 112
  • 211
0
votes
1 answer

Creating an object builder with error handling using Arrow - Pattern match multiple Eithers

I have class A: class A (private var z: String, private var y: String, private var x: Int) I want to create a failsafe builder for it. The builder should return Either the list of Exceptions (e.g. when values are missing) or the created values.…
Patrick
  • 879
  • 2
  • 11
  • 29
0
votes
1 answer

How to map 2 Either values without tupled

I need to take 2 values, each of them is Either and combine them together (or to do anything else) if each of the values is Right. For arrow-kt 0.11.0 it was possible with tupled tupled( "Hello".right(), …
Bukharov Sergey
  • 9,767
  • 5
  • 39
  • 54
0
votes
1 answer

improving applicativeNel validation when result should have the value or nothing

I am currently learning to use ArrowKT and I have the following code for validating an input. I tried to collect all the errors at once and execute the validations in parallel since most of them are done against the database. return…
tzortzik
  • 4,993
  • 9
  • 57
  • 88
1 2 3
8 9