-
Notifications
You must be signed in to change notification settings - Fork 145
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
Compiler error with higher-order types #293
Comments
This is indeed a bug. To verify this, you can try the failing example with Unfortunately, I haven't figured out yet to full extent why some newtypes do work, while others don't. But in this case it is quite clear that the order of the type variables on the LHS is not the same as on the RHS, and this won't work with the encoding for higher ranked types in Java that is utilized in the current implementation. |
Simplest test case I could construct. Compiler generate illegal java code:
Or this. Compiler failed to compile code:
All those test case could be fixed by changing Edit: In the |
So I think the fundamental problem is we treat newtype as just type alias. This usually working fine without any problem. But if we got higher kinded type and RHS and LHS of newtype declaration has different kind signature or kind signature in different order. We can't just think newtype is type alias. We need deal those as special case of newtype. |
There would be multiple solution for this issue:
|
Actually I found current implementation of newtype is some what wrong. I'll open another issue about that. |
First of all, thank you for Frege! A very exciting project!
I found a compiler error, at least in the sense that it did not tell what was wrong with my source code.
Consider the following (working) example:
Now, reversing the [Log t] and a in the tuple of Logger, and modifying the Monad code accordingly, results in the following errors:
Results in the following problem:
At least a work-around exists, by swapping the elements of the tuple.
The text was updated successfully, but these errors were encountered: