I am trying to create a function that has two generic types: one reified, and another derived from the context of its usage (since it is an extension function):
inline fun Either.bypassLeft(transformation: Throwable.()…
It would be a basic question, but I couldn't figure out a solution. I need to initialize a constant out of the right-side value of below either type.
val test: Either = 1.right()
I tried something like below but it shrinks the scope…
With the arrival of Arrow 1.1.x we got the new Effect class.
Up to now, my business classes returned Either to model the effect of returning an error or a value, e.g.:
@Service
class CreateDepartmentUseCaseImpl(
private val…
What are the steps to create my own data type when using arrow.
It's simple to use something like Option with the provided extension constructors like Some(data) or None. However, how can I create my own data type that has functional operators like…
I am trialing the use of Kotlin's Arrow library Either object to handle exceptions within a project.
My experience with it thus far has been OK, but I'm struggling to find a way to handle transactions with Either - and specifically rollbacks. In…
I wonder if it is possible to implement something similar to the do-notation of Haskell in Kotlin on Lists or List-Like structures with monadic properties.
Take following example:
fun cartesianProduct(xs: List, ys: List): List
Digging into the codebase of Arrow I found this deprecation warning above higher-kinded types.
Higher Kinded types and their related type classes will no longer be
supported after Arrow 0.13.0. Most relevant APIs are now concrete over
the data…
I use arrow-kt library and I'm trying to employ Either and IO within the same for comprehension.
Say I have the next piece of code:
IO.monad().binding {
val ans: Either = someFunctionThatReturnsEitherWrappedInIO().bind()
}
Now, I'd…
On SO an explanation is given why a Validation like in scalaz, cats (Scala), or Arrow (Kotlin) can't be a monad.
As far as I understand it's because they've modelled monads in terms of applicative functors and the desired behaviour of a Validation…
I am new to Arrow and try to establish my mental model of how its effects system works; in particular, how it leverages Kotlin's suspend system. My very vague understanding is as follows; if would be great if someone could confirm, clarify, or…
I've been using kotlin arrow quite a bit recently, and I've ran into a specific use case that has me stuck.
Let's say I have a collection of some object that I want to convert to another datatype using a convert function. Let's also say that this…
I am experimenting with Lenses in Kotlin, and I was wondering if there is an elegant way to change multiple attributes at the same time for one object. Let's say my domain looks something like this:
@optics
data class Parameters(
val duration:…