How to configure haskell on android using jhc?

I want to write a Haskell function (type) of type: String -> String to call in Android. The easiest way is apparently to use JHC to generate C code, and then use the Android NDK to create a shared library, but I could not find any documentation for JHC. Does JHC use Cabal to build? Is JHC stable enough to use the Parsec or Attoparsec library?

+6
source share
2 answers

Back in 2011, I had limited success using JHC in a similar way, but for iOS instead of Android. The initial results were good in just starting this thing, but we ended up abandoning the JHC in favor of the GHC precisely because we started getting weird error compilation times in programs that used Parsec. Keep in mind that this was in 2011, so the JHC may have improved significantly since then.

If you want to give GHC a chance, I would recommend looking at this example , which uses GHC 7.8 to compile an Android game. I have not used it in anger yet, but I managed to get it to work on Docker, having made it possible to rebuild the game from scratch and install it on a real Android device, so the approach definitely deserves attention.

UPDATE as of August 2017: Moritz Angerman has published detailed instructions on targeting Android using the GHC cross-compiler .

+3
source

Well, a compiler called eta is probably the most convenient way now.it targets jvm and it will create a jar file so you can directly put this in your project

0
source

Source: https://habr.com/ru/post/984075/


All Articles