stojan
12/15/2021, 12:12 PMviewModelScope
) which calls a suspend function in a Repository layer..... I want to suspend until the repo function executes, but also if the viewModelScope
is canceled I don't wanna cancel the repository operation. I wanna tie the repository operation to an application level scope insteadPeter
12/15/2021, 5:16 PMsimon.vergauwen
12/16/2021, 1:43 PMbuild.gradle.kts
. If you try it, and come across anything broken please let us know 🙂
https://github.com/arrow-kt/backend-arrow-example/blob/86e3bf459a8eda06cd41a17105f807202698cea4/build.gradle.kts#L38Lukasz Kalnik
12/17/2021, 2:52 PMmain
and when I try to build arrow-libs
I get the error:
Project directory '/Users/lukasz/projects/arrow/arrow-libs' is not part of the build defined by settings file '/Users/lukasz/projects/arrow/settings.gradle.kts'. If this is an unrelated build, it must have its own settings file.
ivanmorgillo
12/20/2021, 10:21 AMCoProduct
was removed at some point, but wasn't it replaced by Union
?
Which dependency do I need to get Union2
Union3
etc?abendt
12/20/2021, 2:27 PMdnowak
12/21/2021, 3:38 PMDutch
12/22/2021, 5:52 PMval Meta.injectProperty: CliPlugin
get() = "Inject new property" {
meta(
classBody(this, { true }, fun ClassBody.(c: KtClassBody): Transform<KtClassBody> {
if (c.name?.contains("User") == true) {
return Transform.replace(
replacing = c,
newDeclaration = """
|
| @ColumnInfo(name = "name")
| var name: String = ""
|
| @ColumnInfo(name = "nameabc")
| var nameABC: String = ""
| }""".classBody
)
}
else {
return Transform.empty
}
})
)
}
Jörg Winter
12/22/2021, 6:07 PMPeter
12/23/2021, 1:10 AMMarius Kotsbak
12/23/2021, 11:58 AMOliver Eisenbarth
12/27/2021, 7:22 PMQuantum64
12/27/2021, 8:27 PMLukasz Kalnik
12/28/2021, 10:21 PMarrow-core-retrofit
module. I added a dependency on io.kotest.extensions:kotest-assertions-arrow
but when I try to use the shouldBeRight
assertion the test doesn't compile with the error "Cannot access class 'arrow.core.Either'. Check your module classpath for missing or conflicting dependencies"Quantum64
12/30/2021, 8:02 PMinline val TestOptics.Companion.nullable: arrow.optics.Optional<TestOptics, Int> inline get()= arrow.optics.Optional(
getOrModify = { testOptics: TestOptics -> testOptics.`nullable`?.right() ?: testOptics.left() },
set = { testOptics: TestOptics, value: Int -> testOptics.copy(`nullable` = value) }
)
Is the arrow Optional optic not equivalent to an affine traversal? If not, what is it equivalent to?Gavin Ray
01/01/2022, 7:23 PMarrow-meta
there is a plugin which provides a macro called @Given()
From the tests, it seems to be roughly identical to Scala 3's given
+ using
where you say "This function requires some type Foo
to have a value provided in the context/scope"
Is this sort of like an implementation of the Multiple Receivers proposal as a compiler plugin?
https://github.com/arrow-kt/arrow-meta/blob/8f9e80bfbbcb12c16f025bc5ca7d69cbeeec08[…]gin/src/test/kotlin/arrow/meta/plugins/typeclasses/GivenTest.ktGavin Ray
01/03/2022, 7:09 PMlenses
would be beneficial to for performance purposes, rather than creating an entire new AST object?simon.vergauwen
01/04/2022, 1:38 PMHareendran
01/05/2022, 2:09 AM<kotlin.version>1.5.31</kotlin.version>
but when I use
<dependency>
<groupId>io.arrow-kt</groupId>
<artifactId>arrow-core</artifactId>
<version>0.12.1</version>
</dependency>
<dependency>
<groupId>io.arrow-kt</groupId>
<artifactId>arrow-fx</artifactId>
<version>0.12.1</version>
</dependency>
it leads to a warning that there are multiple koltin jarsKaushalya
01/05/2022, 7:33 AMjulian
01/07/2022, 12:32 AMEither.bifoldMap
take a Monoid
argument, when the monoid basically does no work, since bifoldMap
always combines the mapped values of the Either
with empty
, where the result of that combination is know ahead of time to always be the same as the mapped values. In other words, why jump through the hoop of combining a value with empty
, when we know the result will always be the same original value?julian
01/08/2022, 5:33 PM404
. In case it hasn't already been reported...pakoito
01/09/2022, 11:37 AMeither
blocks with a for/while and a bind should do itleomayleomay
01/10/2022, 7:34 AMsuspend
to replace IO tell apart codes w/o side effects, while thing I could not get is how to enforce it for dependencies? the impure code from dependency will not have suspend
in the function definition, which means we could always use them in a “safe” environment?Hareendran
01/10/2022, 2:59 PMKotlin: Supertypes of the following classes cannot be resolved. Please make sure you have the required dependencies in the classpath:
class arrow.core.Either, unresolved supertypes: arrow.Kind
Hareendran
01/10/2022, 2:59 PMEither
fun getConfigVersion(configId: ConfigId, versionId: ConfigVersionId): Either<DomainError, PIConfigVersion> {
val configVersion = configVersionRepository.findByPiConfigModel_ProfileIdAndVersion(configId.id, versionId.id)
return configVersion?.right() ?: NoVersionsFound("No ConfigVersion found for Config ${configId.id} and version ${versionId.id}").left()
}
Zahara Vidumshikova
01/11/2022, 2:40 PMitbhp
01/11/2022, 5:26 PMkotlin.NoWhenBranchMatchedException: null
at arrow.core.computations.EitherEffect$DefaultImpls.bind(either.kt:20) ~[arrow-core-jvm-1.0.1.jar:?]
I am using the either monad comprehension block and the bind extension function but maybe I am missing something.
I am using arrow version 1.0.1
Basically I have few interface with suspended methods, and one interface exposing a method not suspended (and using jooq in the implementation to handle transactions)
interface Repository {
suspend fun getBy(userId: UserId): Either<Error, List<DomainObject>>
suspend fun update(obj: DomainObject) : Either<ErrorResult, Unit>
}
class TransactionMgmt(private val dslContext: DSLContext) {
fun <T> transaction(
block: () -> Either<Error, T>
): Either<ErrorResult, T> ...
interface Observer {
suspend fun onExpired(obj: DomainObject): Either<ErrorResult, Unit>
}
class ExpireUseCase(
private val repository: Repository,
private val transactionMgmt: TransactionMgmt,
private val observer: Observer
) : UseCase<Request, Response> {
override suspend fun execute(request: Request): Either<Error, Response> =
repository.getBy(request.userId)
.flatMap { obj ->
updateAndNotify(obj)
}
private suspend fun updateAndNotify(objs: List<DomainObject>): Either<Error, Response> {
return objs.fold(initial) { acc, obj ->
transactionMgmt.transaction {
runBlocking {
expire(obj, acc)
}
}
}
}
private suspend fun expire(
obj: DomainObject,
acc: Either<Error, Response>
): Either<Error, Response> = either {
val expiredObj = obj.copy(status = EXPIRED)
repository.update(expiredObj).bind()
observer.onExpired(expiredObj).bind()
Response(acc.bind().count + 1)
}
private val initial: Either<Error, Response> = Response(0).right()
}
Basically I am getting that error in the method
private suspend fun expire(
obj: DomainObject,
acc: Either<Error, Response>
): Either<Error, Response> = either {
val expiredObj = obj.copy(status = EXPIRED)
repository.update(expiredObj).bind()
observer.onExpired(expiredObj).bind()
Response(acc.bind().count + 1)
}
Sorry for the very long post, and maybe I am missing something really stupid but I cannot see it.
(this is a similar version of the actual code I am using, I cannot post the original one)Peter
01/11/2022, 10:57 PM1.0.+
matches 1.0.2-alpha.25
😬