-
Notifications
You must be signed in to change notification settings - Fork 9
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
more purity #32
Comments
Hi Ingo,
module java.nio.File where
data AccessMode = pure native java.nio.file.AccessMode where
pure native read "java.nio.file.AccessMode.READ" :: AccessMode
pure native write "java.nio.file.AccessMode.WRITE" :: AccessMode
pure native execute "java.nio.file.AccessMode.EXECUTE" :: AccessMode
pure native valueOf "java.nio.file.AccessMode.valueOf" :: String -> AccessMode
native values "java.nio.file.AccessMode.values" :: () -> STMutable s (JArray AccessMode)
derive Serializable AccessMode
|
Sorry for bothering .... just noticed that FregeFX was made with native-gen but all Enums are It also turns out that things that used to work when generated code employed raw types only don't work anymore now. One example is
when this is used in a function that needs a wrapper like:
the compiler generates wrong Java code, because it doesn't know about the type bound:
It complaints like:
So this is something I have to resolve before going beta with 3.24 But then, the specification of native methods and classes will become a real pain, so I plan also to support automatic type derivation for native methods and classes. I hope you don't mind, since this will necessarily duplicate native-gen functionaity. But in the case of Util.fr we have already seen and are confirmed in FregeFX that the native-gen approach is barely maintenable anymore for big things. |
Not at all, that would actually be better. Thanks for asking. We can deprecate this project once it is done and eventually close it. |
I have two questions/suggestions:
Can we make types that have superclass Enum
pure
by default? And generate an Eq instance, maybe?If a class is marked as @FunctionalInterface, the data definition should also be
pure
. The method, of course, is not affected by this, e.g:data EventHandler e = pure native javafx.event.EventHandler where
native handle :: EventHandler e -> e -> IO ()
The text was updated successfully, but these errors were encountered: