Arrow: Prototype: support for Kotlin Native

Created on 11 Aug 2017  路  19Comments  路  Source: arrow-kt/arrow

Just as a fun proof of concept see what would be required to make the library compatible with kotlin-native: https://github.com/JetBrains/kotlin-native

Places where we use JVM classes:
https://github.com/kategory/kategory/search?utf8=%E2%9C%93&q=import+java.&type=

Some of them seem like Serializable instances we could just remove. Effects uses concurrency primitives that can be moved to a separate module. Typeclass uses reflection interfaces that I believe are already matched by Kotlin's reflection package, note that said package dependency is quite large.

discussion enhancement help wanted

Most helpful comment

Hi, is there any updates on this?

All 19 comments

@pakoito I want to help with that. The current implementation is AP heavy, what we could extract to common kotlin module to share between JS/JVM/Native?

@grabstepango IIRC coroutines are not available in Kotlin Native yet, so that's a limitation on monad comprehensions. Everything else, happy for someone to give a hand!

I would start with the basics, making the datatypes in core work on KN, then move to typeclasses and instances. The boilerplate written by the AP doesn't have any magic to it, so you should be able to write it manually for KN. I'm not sure whether AP is still available and compatible for KN builds though, because that'd be great.

It's all experimental, so you'll be providing the answers :D

Will be great to support JS/JVM/Native to use this library in Kotlin multiplatform projects.

Does Arrow currently work only on JVM projects?

Yes, although we're taking steps to remove the largest dependencies like instance lookup using JVM's reflection APIs, and isolating all platform-dependent constructs.

Right now it'd be great if someone took ownership of the multiplatform project split, and I'll happily contribute with anything that's necessary.

I think after 0.7.0 which will eliminate the runtime reflection system most of the lib would be compatible and we can modularize accordingly. Perhaps moving comprehensions and any non native supported syntax to its own module.

Is there any new about it, looking forward to see it and perhaps testing it

Not much progress currently, we're still at

Right now it'd be great if someone took ownership of the multiplatform project split, and I'll happily contribute with anything else that's necessary.

Kotlin native has support for coroutines (single threaded code though)
And what modules should be included in the common module?

At the moment I can try and work with the core module producing a .klib and trying to make a simple template project from it.
Is it fine?

Yeah, it'd be great to know how many of the modules are currently compatible with Kotlin Native. Thanks! Put a PR with your findings, maybe in a new module in the docs folder: https://github.com/arrow-kt/arrow/tree/master/modules/docs

Started working now, I cloned the repo, but there are few "Unresolved reference" errors in classes
TryOf, EitherOf ect...
What should I do?

How's this going? There's been no activity in this ticket for nearly a year - but has it been going on elsewhere?

Hi @philsquared,

We're working on a work around for the code generated by kapt. There is a channel on Slack where we discuss this #arrow-meta. We hope to reach 1.0 before the end of the year and we'd love to be a MPP by then but we're currently blocked a little since there is no meta programming facilities for MPP in Kotlin yet.

Most code is (almost) ready since we've kept this in the back of our head the whole time, and we always keep this in account while we work towards 1.0.

We're hopeful but dependent on building our own solution for MPP meta programming, or Kotlin's official solution.

Thanks for the rapid update, @nomisRev - good to hear!

Hi, is there any news about this?

We're working on removing the dependency on kapt, which is the main blocker for arrow-core.

Hi! How can I help, is there a slack channel I should join?

Go to #arrow-meta :D

Hi, is there any updates on this?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jmfayard picture jmfayard  路  4Comments

lgtout picture lgtout  路  4Comments

pakoito picture pakoito  路  3Comments

AntonioMateoGomez picture AntonioMateoGomez  路  4Comments

ovu picture ovu  路  4Comments