tweag / sparkle

Haskell on Apache Spark.
BSD 3-Clause "New" or "Revised" License
447 stars 30 forks source link

Preliminary bazel support. #133

Closed Fuuzetsu closed 6 years ago

Fuuzetsu commented 6 years ago

For the most part this should be self-explanatory but there are a couple of things that need to be talked about and resolved in the future one way or another, be it in sparkle/inline-java or rules_haskell.

w.r.t. javac: the problem in general is that we want to define a toolchain from a rule that's using the toolchain. I think the best way to solve this would be to use two toolchains:

We could have a third toolchain which is just GHC only but it adds a chance that we mix GHC being used &c. (which may be OK).

I am unsure if this approach is doable, I have not explored it yet. It would likely require defining some sparkle_toolchain with appropriate rules_haskell toolchain type.


There was also talk about inline-java instead outputting Java files that we could then compile. In theory this would be the nicest way for us as long as we know what it outputs. I don't see however how it would work in practice: as far as I understand, the Haskell compilation relies on the bytecode being produced during compilation and it's used for things (type inferrence?). Further our existing Haskell rules can't accommodate such a stop-start approach: they always expect that a library is produced in the end. We would need some custom rule that only spits out the generated Java files, we'd have to compile those then we still have to figure out how to supply it back to GHC for the rest of the compilation.

Fuuzetsu commented 6 years ago

This is for most part a discussion PR about what approaches we want to take, whether changes in sparkle/inline-java would make things easier &c.

Fuuzetsu commented 6 years ago

Closing in favour of solution through https://github.com/tweag/rules_haskell/issues/80

facundominguez commented 6 years ago

Delete the bazel branch?

Fuuzetsu commented 6 years ago

I'll be updating it with new solution soon hopefully.