Youssef Shoaib [MOD]
03/13/2021, 3:51 PM@with
decorator for each pair of ins-and-outs, as in you'd need all of an @with(optionFunctor<Int, String>())
, an @with(optionFunctor<String, String>())
, an @with(optionFunctor<Unit, String>())
, and an @with(optionFunctor<Any, String>())
in the above example to make it work, and that multiples massively for each different type of input or output that you need to include, while with the splitting you only need to have a decorator for the sum of the number of inputs and outputs that you have. I think that probably having a huge amount of decorators will make the code look ugly even if it was generated automatically by the IDE, but I still have that original code if needed. Hopefully though you guys have already made a much much better encoding than this horrendous mess lol.Anders Sveen
03/15/2021, 11:59 AMeither {
val id = parse(info).bind()
val result = fetch(id).bind()
Either.catch { ... }.mapLeft { ... }
}
And I am trying to get MDC logging to propagate through all of these calls. But it seems Arrow is dispatching on a new CoroutineContext so the MDCContext() in the original context is not propagated. Any pointers as to how I can get this to run with the "parent" context? IO.unsafeRunScoped seems relevant but not applicable... 🙂Jörg Winter
03/16/2021, 2:15 PMJörg Winter
03/17/2021, 8:35 PMpakoito
03/17/2021, 11:57 PMvalidated { }
with something that takes a varargs of Validated
valuescarbaj0
03/20/2021, 6:04 AMDuplicate class arrow.core.ListKt found in modules arrow-core-data-0.12.0-SNAPSHOT (io.arrow-kt:arrow-core-data:0.12.0-SNAPSHOT:20210318.205637-108) and arrow-syntax-0.12.0-SNAPSHOT (io.arrow-kt:arrow-syntax:0.12.0-SNAPSHOT:20210318.205637-105)
stojan
03/21/2021, 10:43 AMBenoît
03/22/2021, 11:04 AMCLOVIS
03/22/2021, 6:42 PMFred Friis
03/24/2021, 12:56 AMclass UserResource (private val userDao: UserDao) {
@POST
fun post(CreateUserRequest createUserRequest){
return IO
.fx {
userDao.create()
}
}.runUnsafe something something
.toEither()
.fold({ left ->
Response.serverError()
},{ right ->
Response.success(right)
})
}
Jonathan Smith
03/24/2021, 11:43 AMhttps://youtu.be/VOZZTSuDMFE▾
Benoît
03/24/2021, 2:42 PMFred Friis
03/25/2021, 3:00 AMDavide Giuseppe Farella
03/25/2021, 1:10 PMEither
, which is the best way to get left?
Example
// ok
assertEquals(expectedResult, either.orNull())
// how?
assertEquals(expectedError, either.<leftOrNull()>)
pajatopmr
03/27/2021, 6:21 AMseetha
03/29/2021, 9:33 PMarrow.fx.coroutines.Schedule
. Is there a way to get the number of attempt in the Either.catch
Either.catch{
retry(Schedule.exponential(250.milliseconds)) {
evalOn(IOPool) {
//do something
incrementMetricSuccess(attempt) -------> want to increment metric with the attempt it got successful
}
}
}.mapLeft {
incrementMetricSuccess(attempt) -------> want to increment metric with the attempt to fail
}
dnowak
03/29/2021, 10:12 PM.curried
extension functions on functions is deprecated. Is there any replacement for that?
I was using that method for dependency injection
for functions.
I assumed that currying
is a basic operation in FP. Why it is being removed?carbaj0
03/31/2021, 1:13 PMthan_
03/31/2021, 2:13 PMAppState(tuple.a, tuple.b, tuple.c, tuple.d, tuple.e)
but Tuple5 doesn't have a, b, c... props anymore. it has first, second third... Is this just "we are in the middle of release, so things don't yet line up", or is it bug that slipped through?Brad M
03/31/2021, 3:40 PMsuspend fun
, but a library we use (java-dataloader
) requires functions with a CompletableFuture return type. How have folks been switching between CompletableFutures
and suspend
?Satyam Agarwal
03/31/2021, 4:23 PMval (a: A, b: B) = parZip({ funA() }, { funB() }, ::Pair)
but this works :
val (a: A, b: B) = parZip({ funA() }, { funB() }) { a, b -> a to b }
in v0.13.0Satyam Agarwal
03/31/2021, 5:57 PMv0.13.0
private fun methodThatThrows(): Either<Throwable, Unit> = Either.catch { throw CancellationException("") }
@Test
fun `test parTraverse`(): Unit = runBlocking {
val result: Either<Throwable, Unit> = either {
(1..20).parTraverse { methodThatThrows().bind() }
}
result shouldBe CancellationException("").left()
}
I cannot reach assertion, and throws as soon as methodThatThrows
is called.
cc: @simon.vergauwen (Sorry for tagging you on easter vacation, just want to make you aware 🙂 )julian
03/31/2021, 10:09 PM0.13
doesn't appear to have a Tuple3
. Tuples start at Tuple4
. Is this correct?Daniel Berg
03/31/2021, 11:07 PMMaureen
04/01/2021, 3:30 PMCLOVIS
04/01/2021, 9:57 PMjem
04/02/2021, 5:50 AMReader
type after upgrading to 0.12.0. (MTL is still on 0.11.0 though). After this upgrade:
- val arrowFx = "io.arrow-kt:arrow-fx:0.10.5"
- val arrowMtlData = "io.arrow-kt:arrow-mtl-data:0.10.5"
- val arrowOptics = "io.arrow-kt:arrow-optics:0.10.5"
+ val arrowFx = "io.arrow-kt:arrow-fx:0.12.0"
+ val arrowMtlData = "io.arrow-kt:arrow-mtl-data:0.11.0"
+ val arrowOptics = "io.arrow-kt:arrow-optics:0.12.0"
I find that reader.run(thing).value()
is no longer able to resolve .value()
. How should it read now?
.run(thing)
is returning type Kind<ForId, T>
jem
04/02/2021, 6:48 AMfun <T> IO<T>.retry(
until: (T) -> Boolean = { true },
additionalTimes: Int = 4,
initialDelay: Duration = 500.milliseconds
): IO<T> {
val schedule = Schedule
.withMonad(IO.monad()) {
exponential<Either<Throwable, T>>(initialDelay)
.untilInput<Either<Throwable, T>> { it.exists(until) }
.and(recurs(additionalTimes))
.jittered(IO.monadDefer())
.zipRight(identity())
}
return map<Either<Throwable, T>> { it.right() }
.handleError { it.left() }
.repeat(IO.concurrent(dispatchers()), schedule).fix()
.flatMap {
it.fold({ throwable -> IO.raiseError(throwable) }, { t -> IO.just(t) })
}
}
niltsiar
04/02/2021, 9:01 AMEither.catch
with suspend
functions is deprecated and the inline one is not accepting them. How should it be done with this new version?Cody Mikol
04/02/2021, 3:34 PMsuspend fun foo() = either {
val foo = !getFoo()
val bar = !getBar()
val foobar = !foobarFactory.make(foo, bar)
}
are foo
and bar
evaluated concurrently and then foobar
once its dependencies have resolved?
I’m trying to get a better overview of how arrow handles these suspended functions. Currently we are using either.eager
, but I’d like to better understand the non-blocking either
so I can benefit from that.Cody Mikol
04/02/2021, 3:34 PMsuspend fun foo() = either {
val foo = !getFoo()
val bar = !getBar()
val foobar = !foobarFactory.make(foo, bar)
}
are foo
and bar
evaluated concurrently and then foobar
once its dependencies have resolved?
I’m trying to get a better overview of how arrow handles these suspended functions. Currently we are using either.eager
, but I’d like to better understand the non-blocking either
so I can benefit from that.simon.vergauwen
04/02/2021, 3:38 PMeither.eager
does.
The only difference between either.eager
and either
is that in the latter you can call suspend fun
from inside the { }
block.Cody Mikol
04/02/2021, 3:39 PMsimon.vergauwen
04/02/2021, 3:40 PMeither { }
like so.
suspend fun foo() = either {
val (foo, bar) = parZip(
{ getFoo().bind() },
{ getBar().bind() })
{ foo, bar -> Pair(foo, bar) }
val foobar = !foobarFactory.make(foo, bar)
}
Cody Mikol
04/02/2021, 4:04 PM