Add support for Scala Native
Cats (https://github.com/typelevel/cats) recently added support (https://github.com/typelevel/cats/issues/1549) for cross-compiling to scala native.
Scala Native support in fs2 would be be very helpful.
This would of course depend on cats-effect support for Scala Native, as well. https://github.com/typelevel/cats-effect/issues/1302
I started some preliminary investigation in https://github.com/armanbilge/fs2/commit/20a1dbb0159105c9e37106aa1e1b52bd74102863 based on https://github.com/typelevel/cats-effect/pull/3057.
Crossing fs2-core is straightforward.
- porting
java.util.zip.InflaterOutputStreamto Scala Native would unblock compression
fs2-io is a lot more work. I focused only on the fs2.io.file package for now.
java.nio.file.Path#registeris missing- so is
java.util.stream.Stream#forEach
Without those, cross-compiling fs2.io.file will require complex splitting/platforming to remove Watcher (which is otherwise very nearly supported). We should port the missing APIs to Scala Native instead.
Furthermore, when running the fs2-io suite on Native I encountered the following failures.
X fs2.io.file.FilesSuite.permissions - innappropriate access should raise AccessDeniedException
X fs2.io.file.FilesSuite.delete - should fail on a non empty directory
X fs2.io.file.PathSuite.Monoid[Path]: monoid.right identity
The underlying bugs should all be fixed in Scala Native.
PRs:
- https://github.com/scala-native/scala-native/pull/2749
- https://github.com/scala-native/scala-native/pull/2748
- https://github.com/scala-native/scala-native/pull/2747
- https://github.com/scala-native/scala-native/pull/2745
- https://github.com/scala-native/scala-native/pull/2753
Issues:
- https://github.com/scala-native/scala-native/issues/2750
- https://github.com/scala-native/scala-native/issues/2751
PR is up at https://github.com/typelevel/fs2/pull/2975.