Closed wadejensen closed 3 years ago
@wadejensen I think this is everyone's desire as well but nobody currently pushing the lib has that use case. If you want to give it a shot the first thing we have to do is compile a shopping list of what needs to change currently in the code base to support Kotlin JS/Native and we can take it from there recommending approaches to tackle each one of the parts.
Thanks for the response @raulraja. My use case is very casual at the moment, so I don't have bandwidth to dedicate to this, but if that changes I will give it a red hot go.
@AregevDev took a look for the Native port, and we're currently blocked on kapt
and KindedJ. There's also a concurrent map in some memoization function, but that's fixable.
@pakoito so no kapt on js and native?
No, and no plans for it either.
Maybe try to generate the code and then call the compiler to include the generated classes?
They are only generating a class
and two typealias
s...
what is kapt used for, only for the @optic
annotations ?
@higherkind is the blocker for arrow-core, @extends for arrow-typeclasses
I also assume kapt (specifically annotation processors) will not be a thing for JavaScript either. We'd probably need to look for alternatives on code derivation for both platforms that can have a common API but implemented differently.
How do projects like kotlinx.serialization etc work? Are they providing their own compiler plugin? Maybe that is a way to go, may be a lot of work tho.
(I don't know much about JVM annotation processors, so maybe this is very dumb)
My understanding is that Kapt, like other annotation processors, will generate extra .kt files, which are then included in the regular compilation process. Would it be possible to run Kapt in a JVM environment to generate these files, and then compile everything with the Kotlin/JS compiler? I'm curious to know why not if not.
Maybe https://github.com/Foso/MpApt could be used instead of kapt? It supports multiplatform.
My use case is that I'm writing a library that I want to be able to use on iOS as well as JVM targets (including Android). It would be super awesome if Arrow could do this.
Hey @kierans, (and everyone following this thread) These efforts are currently in progress. You can follow the progress in the PRs.
Here is a link to the PR working on JS support (almost finished for Arrow Core), Native is up next :) https://github.com/arrow-kt/arrow/pull/2409 Native for Arrow Fx Coroutines might be a little delayed compared to other libraries, since the underlying library KotlinX Coroutines support for native is still experimental and not officially released under the stable releases AFAIK.
As soon as this is merged you can try it on th SNAPSHOT release, the first MILESTONE for Arrow 1.0.0 is expected this summer.
@raulraja Can you say why you closed this please? It seems a bit arbitrary.
I see that #2409 got merged, but I'd say proper support also requires documentation on setting up a multiplatform project with Arrow (and perhaps which Arrow libraries work with JS and which ones don't).
@kierans @viluon Arrow is now MPP in main, and all tests are passing. The site also is being published next week with instructions to include Arrow MPP in any project as soon as we can add the native tests, which we are waiting for support for Kotest. I closed this because the work is done but reopening now until it's all available to the public.
Thanks for the update @raulraja.
For those wanting to try Arrow on JS. https://github.com/arrow-kt/Arrow-JS-Template
This ticket can finally be closed 🥳 Arrow 1.0 comes with JS support! If you have any feedback be sure to create an issue here, or chat in #arrow on Kotlin Slack.
@nomisRev Given this ticket was also about "multi platform support", does this also mean that Arrow 1.0 can be used in native code eg: iOS?
@nomisRev Given this ticket was also about "multi platform support", does this also mean that Arrow 1.0 can be used in native code eg: iOS?
Yes!!
I believe we still lack compiler support for Optics on non-JVM platforms? If so, is there an ongoing effort or existing issue about it?
If there's none, I'd like to open a feature request so that I could keep track of updates.
Hey @mysticfall,
This is already in progress on the Arrow Meta repo, and we're currently testing it before releasing it. There is a ticket here, https://github.com/arrow-kt/arrow-meta/issues/771.
@nomisRev Thanks much for the info! I'll subscribe to the issue then. Can't wait to test it myself :)
I went to use Arrow for a frontend application transpiled from Kotlin to JavaScript and realised that it Arrow doesn't support the JS platform due to explicit Java dependencies. It would be awesome to see Arrow migrate to being a multiplatform library.