simon.vergauwen
04/29/2024, 2:08 PMcontext(Raise<E>)
val <E, A> Either<E, A>.value: A
inline get() = when(this) {
is Either.Left -> raise(value)
is Either.Right -> value
}CLOVIS
04/29/2024, 2:20 PM.bind() ?simon.vergauwen
04/29/2024, 2:21 PMbind but a lot of people judge Arrow solely on bind. And it just came up again in Scala.CLOVIS
04/29/2024, 2:21 PMsimon.vergauwen
04/29/2024, 2:22 PMsimon.vergauwen
04/29/2024, 2:22 PMCLOVIS
04/29/2024, 2:22 PMbind can be deprecated (or just removed from the examples in the doc)CLOVIS
04/29/2024, 2:23 PMphldavies
04/29/2024, 2:45 PM@RaiseDSL
public val <A> Either<Error, A>.value: A
get() = when (this) {
is Either.Left -> raise(value)
is Either.Right -> value
}
inside the interface Raise<E> definition?simon.vergauwen
04/29/2024, 2:46 PMphldavies
04/29/2024, 2:46 PMinline)simon.vergauwen
04/29/2024, 2:47 PMphldavies
04/29/2024, 2:49 PMRaise<E> interfaceKev
04/30/2024, 11:16 AMCLOVIS
04/30/2024, 12:08 PMeither {
someOtherFunction().getOrRaise() // instead of .bind()
}
Personally I'm not a fan, because I'm accustomed to .bind now, but I can see how it would be more intuitive for beginners.CLOVIS
04/30/2024, 12:11 PMprovideDelegate (which IMO is the DSL's most hidden secret):
• I was looking at the Gradle DSL, and I was really confused as to how it worked
• I tried to replicate it, but couldn't
• I looked in the Gradle source code (CTRL B in IDEA) and found it was calling provideDelegate
• Then I found the function in the Kotlin stdlib doc website, then I played with it quite a bit