We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
As per spec this is not currently supported. But javac support them just fine and they are quite useful. The following program return true in Java:
import java.util.function.Function; import java.util.function.Supplier; @FunctionalInterface public interface Maybe<A> { <X> X fold(Supplier<X> empty, Function<A, X> just); static <A, X> X empty0(Supplier<X> empty, Function<A, X> just) { return empty.get(); } static <A> Maybe<A> empty() { return Maybe::empty0; } static void main(String[] args) { Maybe<?> emptyString = Maybe.<String>empty(); Maybe<?> emptyInt = Maybe.<Integer>empty(); System.out.println(emptyString == emptyInt); // print "true". } }
Fixing this issue would mean that the following code compile and print "true":
trait Maybe[A] { def fold[X](empty: => X, just: A => X): X } object Maybe { def empty0[A, X](empty: => X, just: A => X): X = empty def empty[A]: Maybe[A] = empty0(_ , _) // does not compile def main(args: Array[String]): Unit = { val emptyString: Maybe[String] = Maybe.empty val emptyInt: Maybe[Integer] = Maybe.empty print(emptyString eq emptyInt) // how to make this print "true"??? } }
The text was updated successfully, but these errors were encountered:
Imported From: https://issues.scala-lang.org/browse/SI-9916?orig=1 Reporter: Jean-Baptiste Giraudeau (jbgi) Affected Versions: 2.12.0-RC1
Sorry, something went wrong.
No branches or pull requests
As per spec this is not currently supported.
But javac support them just fine and they are quite useful. The following program return true in Java:
Fixing this issue would mean that the following code compile and print "true":
The text was updated successfully, but these errors were encountered: