We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 44c1ec1 commit c11a3fdCopy full SHA for c11a3fd
tests/run/cochis-example.scala
@@ -0,0 +1,14 @@
1
+
2
+import Predef.{$conforms => _}
3
+trait A {
4
+ implied id[X] for (X => X) = x => x
5
+ def trans[X](x: X) given (f: X => X) = f(x) // (2)
6
+}
7
+object Test extends A with App{
8
+ implied succ for (Int => Int) = x => x + 1 // (3)
9
+ def bad[X](x: X): X = trans[X](x) // (4) unstable definition !
10
+ val v1 = bad [Int] (3) // (5) evaluates to 3
11
+ assert(v1 == 3)
12
+ val v2 = trans [Int] (3)
13
+ assert(v2 == 4)
14
0 commit comments