-
Notifications
You must be signed in to change notification settings - Fork 50
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
GADT : total getters for specific types #25
Comments
indeed! static SData.Add1 getAdd1(Seminar<Temp> temp) {} should replace static <T> Option<SData.Add1> getAdd1(Seminar<T> temp) {} or should we have both? (I think haskell only generate the former getter) |
The return type would prevent ambiguity, wouldn't it ? In any case, I think we should generate them both. |
@gneuvill the return type is unfortunately not taken into account by javac when checking for erased method clash. What do you think of static SData.Add1 getAdd1(Seminar<Temp> temp) {} and static <T> Option<SData.Add1> getAdd1Option(Seminar<T> temp) {} for naming ? |
|
Would a proper solution to this amount to generate the following ? // 'Void' here is fj.Void
private static final Void contradiction(TypeEq<Temp, Init> contradiction) {
return null; // what else could/should it be ?
}
public static SData.Add1 getAdd1(Seminar<Temp> temp) {
return caseOf(temp)
.Init((core, eq) -> contradiction(eq).absurd())
.Temp((core, add1, eq) -> add1);
} But then since |
Hi Jean-Baptiste,
Let's say we have the following GADT :
then the following function
has to be written by hand, as you can see.
Would it be possible, in the case of GADTs, to generate total getters for specific cases ?
The text was updated successfully, but these errors were encountered: