Arkadii Ivanov
02/20/2020, 8:31 PMarrow-fx
tests supposed to work now? Running like ./gradlew :arrow-fx-rx2:test
but no tests are executed.Jannis
02/22/2020, 12:01 PMarrow-test
.
• It being in its own repo means other repos will use a snapshot version of it. This means that the changes we are testing are not present in the compiled code of arrow-test
. As an example: I have a pr that changes the signature of a method in Applicative
in arrow-core
. In arrow-test
we have, in TraverseLaws
, a law which uses Id.applicative
and IO.applicative
which both come from the snapshot of arrow-core
. This means they don't have the changes and this leads to `AbstractMethodError`'s at runtime. This was partially solved by @Rachel with a short term workaround already by recompiling arrow-test
with a current version of the current repo before testing. For this pr this meant that the tests using Id.applicative
worked fine, but IO.applicative
still failed because it came from arrow-fx
and that is not being recompiled (it does not even have the required changes!). There are probably other compile issues similar to this, which are less discover-able and harder to debug.
• Any change in a core repo that changes a datatypes representation, it's equality instance or any method signature covered by laws has to first change arrow-test
otherwise it will never pass a test. This is a significant hindrance for changes as it leads to lots of fractured prs.
In my opinion the best way out of this is to split arrow-test
for each repo, such that arrow-core
has arrow-test-core
etc. Then force arrow-test-core
to only depend on local projects (or other arrow-test-*
). This would mean that changes to, for example, arrow-core
that would otherwise need to go to arrow-test
are now local. It still means we need to create follow up prs in the other repos, but solves the issues with the laws. Splitting this up is also a fast process which can be done incrementally: Create a new module per repo, copy all laws/generators and eq instances for this repo and last make all local tests depend on it. This technically should mean no test has to change (although some laws may have to change, like TraverseLaws
).
Unrelated to this I'd also propose to rename arrow-test
to something like arrow-laws
as it really only contains laws, generators and equality instances, not actual tests.
Thoughts/opinions/other ideas?PhBastiani
02/26/2020, 4:59 PMJannis
02/27/2020, 4:40 PMPhBastiani
02/27/2020, 6:43 PMpakoito
03/02/2020, 10:55 AMpakoito
03/02/2020, 3:17 PMaballano
03/03/2020, 4:04 PMdnowak
03/06/2020, 3:05 PMGopal S Akshintala
03/16/2020, 11:18 AMaballano
03/18/2020, 1:20 PMcancellableReceivesCancelSignal
test, any help here would be greatly appreciated.
Also, I noticed that incubator provides its own instances of genK and eqK for IO -> https://github.com/arrow-kt/arrow-incubator/blob/master/arrow-mtl-data/src/test/kotlin/arrow/mtl/test/generators/GenK.kt#L20 so I’d also like to ask if there’s a specific reason not to use the provided in fx-test // cc @JannisSatyam Agarwal
04/04/2020, 11:10 AMraulraja
04/08/2020, 10:00 AMstojan
04/25/2020, 1:06 PMCallAdapter
that would work with:
interface Service {
@GET("/")
suspend fun bodyEither(): Either<String, String>
@GET("/")
suspend fun bodyResponseE(): ResponseE<String, String>
}
// a more FP/Kotlin friendly version of retrofit2.Response
data class ResponseE<E, A>(
val raw: okhttp3.Response,
val code: Int,
val message: String?,
val headers: Headers,
val body: Either<E, A>
) {
val isSuccessful: Boolean = raw.isSuccessful
}
where the you can put the error body on the left. Would that be a good fit for arrow-integrations
?pakoito
04/28/2020, 11:55 PMEither.cond
to Either.invariant
and making the left side the error one?pakoito
05/02/2020, 8:15 PMHiosdra
05/06/2020, 9:09 AMSatyam Agarwal
05/07/2020, 4:22 PMfun <A> Validated<NonEmptyList<YourType>, A>.toIO(): IO<A> {
return when (this) {
is Valid -> this.a.just()
is Invalid -> YourErrorType(this.e).raiseError()
}
}
pablisco
05/09/2020, 7:55 PMarrow-fx
project and I need to target jdk8
.
I’ve changed the dependency to kotlin to use kotlin-stdlib-jdk8
and I’ve added the following:
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
}
sourceCompatibility = "1.8"
targetCompatibility = "1.8"
I wasn’t sure if I needed both (kotlin and java compatibility markers) but I was trying to make it work.
I’ve even changed JAVA_VERSION
to be 1.8
on the modules gradle.properties
file.
Any who, despite all these changes, I’m getting the following errors from Animal Sniffer:
[Undefined reference] arrow.fx.(_IO.kt:19)
>> boolean java.util.concurrent.CompletableFuture.complete(Object)
[Undefined reference] arrow.fx.(_IO.kt:20)
>> boolean java.util.concurrent.CompletableFuture.completeExceptionally(Throwable)
[Undefined reference] arrow.fx.(_IO.kt:21)
>> boolean java.util.concurrent.CompletableFuture.completeExceptionally(Throwable)
[Undefined reference] arrow.fx.(_IO.kt:8)
>> Object java.util.concurrent.CompletableFuture.get()
[Undefined reference] arrow.fx.(_IO.kt:16)
>> java.util.concurrent.CompletableFuture
[Undefined reference] arrow.fx.(_IO.kt:16)
>> void java.util.concurrent.CompletableFuture.<init>()
[Undefined reference] arrow.fx.(_IO.kt:12)
>> boolean java.util.concurrent.CompletableFuture.cancel(boolean)
I’m having a look at this ticket: https://github.com/arrow-kt/arrow-fx/issues/153
These APIs were introduced on the jdk8, so this module needs to target that version (hence why it’s a separate module)
Anyone has experienced on how to configure animal sniffer in this instance?
If you want to check it locally this is the branch: https://github.com/arrow-kt/arrow-fx/tree/pabs-completable-future-integrationstojan
05/11/2020, 4:31 PMdnowak
05/13/2020, 3:06 PMIO
. I simply want to register the time it took to execute the IO
. I have implemented .timed
extension function that can be executed on IO. But I also want to have the possibility to call .timed
on a function that returns IO. And have to generate 22 versions of that method 🙂. You have probably had the same “issue” (like with memoize
). Do you have some ready to copy solution 🙂?stojan
05/16/2020, 11:00 AMHadi Lashkari
05/19/2020, 10:13 AMstojan
05/21/2020, 7:27 PMHadi Lashkari
05/26/2020, 6:39 AMfilterIsInstance
and traverseFilterIsInstance
but I have a problem
• arrow-meta
cannot handle java.lang.Class
correctly. It generates import kotlin.Class
which doesn't exist! I tried to add .replace("java.lang.Class", "")
in fun String.asKotlin(): String
but it didn't solve the problem! Also in fun TypeName.Classy.asKotlin(): TypeName.Classy
there is a condition for Iterable
but didn't work with Class
!
• Also I tried with kotlin.reflect.KClass<T : Any>
but arrow-meta
cannot handle the T : Any
part!
Any suggestion to solve it?Hiosdra
06/01/2020, 11:30 AMIO<Nothing, A>
Kotlin compiler(??? or Jvm?) erases all information about generics in this class. If method returns IO<E, A>
where E is any type but Nothing
, generic info is kept.
Retrofit integration needs generic info, because Retrofit is a runtime library. I’ve also tested merged into master suspend + Either integration and it fails in the same place.
Do anyone has some more knowledge about bytecode representation of Nothing
and why compiler/Jvm do that only for Nothing
type?
Below are photos with brakepoint on adapterType = method.getGenericReturnType()
(HttpServiceMethod.java:62)HieiJ
06/03/2020, 7:18 AMParApplicative
was quite easy but then it let some other hidden bugs come out... One on IO related to stack safety and one on Rx2 related to fork/join. I've patched the code in order to make it work but, without knowledge about the rationale of the design of the code, I suppose that there could be better ways to solve them. Anyway, my PR is: https://github.com/arrow-kt/arrow-fx/pull/167. How should I proceed now?raulraja
06/04/2020, 9:58 AMAttila Domokos
06/05/2020, 2:59 PMRachel
06/05/2020, 3:48 PMRachel
06/05/2020, 3:48 PMpakoito
06/05/2020, 3:50 PMRachel
06/05/2020, 3:51 PMrcd27
06/06/2020, 10:12 AMMapK
😅 Can you make my pic tiny? 😄Rachel
06/08/2020, 8:42 AM