New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problems with Function being returned? #323
Comments
This is most probably a compiler error. BTW, great documentation. |
Oh, and I am using frege 3.24.100.1-jdk8
Awesome. Thanks!
Always. How else would you be able to help me :)? |
The error comes about because of difficulities with the encoding of higher kinds in Java. Since type variables in Java can only have kind
for Haskell
This worked fine so far in type classes, but in your case the we have the more complex a (a b c, b) c where the second a appears as type argument of the tuple which itself appears as the type argument of the function. Therefore, the cast fails in the instance for (->). Although Java knows that an unary function This happens apparently only with type classes/instances where the implementation uses subtyping. Interestingly, the following encoding of the type class works fine:
I'll check if I can repair the code generation for instances with higher kinded type arguments. But it may take until next week. |
Ah thanks, I think this will suit me more however:
|
Or even better (this gives me the exact same syntax):
Thanks a lot :) |
I want to implement the following:
but I get this error during the Java compilation step:
This is due to this code being wrongly generated:
However, if I remove the
.call()
from ƒapp() this would compile (accordingly to IntelliJ code highlighting).I have read somewhere that this can be due to the fact that Frege doesn't have support for Functions being returned as objects. But is this really due to that as the fix is would be quite easy?
Am I missing something? If no, can I somehow work around this (maybe by declaring native Java code?
The text was updated successfully, but these errors were encountered: