I'm trying out frege, and I'm struggling to try to use some native Java libraries.
I'm trying it out with the leiningen plugin, and Joda time. Apparently the lein plugin doesn't take care of correctly seeting the classpath for fregec, or maybe it's related to this difference:
java -jar ~/Downloads/frege3.22.524-gcc99d7e.jar -fp ~/.m2/repository/joda-time/joda-time/2.7/joda-time-2.7.jar src/Hello.fr
Will be able to find Joda, as expected, while
java -cp ~/.m2/repository/joda-time/joda-time/2.7/joda-time-2.7.jar -jar ~/Downloads/frege3.22.524-gcc99d7e.jar src/Hello.fr
will fail with
`org.joda.time.Years` is not a known java class
This shouldn't happen since, according to the wiki
The current class path of the running JVM plus the target directory are always on the class path.
Still, even after manually setting the -fp
, this code fails to compile:
module Hello where
data JodaYears = native org.joda.time.Years where
pure native years :: Int -> JodaYears
pure native getYears org.joda.time.Years.getYears :: JodaYears -> Int
-- ^ I tried both with and without this
The error is
Instance method or getter must be applied to java reference type.
But the only instance method that I'm using (getYears), takes the reference type as input (JodaYears
)... I even tried with org.joda.time.Years
, but the compilation still fails
Thanks to anyone who might shed some light on this