@@ -4,6 +4,9 @@ import scala.language.future
4
4
trait Ord [X ]:
5
5
def compare (x : X , y : X ): Int
6
6
7
+ trait Show [X ]:
8
+ def show (x : X ): String
9
+
7
10
val less1 = [X : Ord ] => (x : X , y : X ) => summon[Ord [X ]].compare(x, y) < 0
8
11
9
12
val less2 = [X : Ord as ord ] => (x : X , y : X ) => ord.compare(x, y) < 0
@@ -17,4 +20,12 @@ val less3: Comparer = [X: Ord as ord] => (x: X, y: X) => ord.compare(x, y) < 0
17
20
// type Comparer2 = [X: Ord] => Cmp[X]
18
21
// val less4: Comparer2 = [X: Ord] => (x: X, y: X) => summon[Ord[X]].compare(x, y) < 0
19
22
20
- val less5 = [X : [X ] =>> Ord [X ]] => (x : X , y : X ) => summon[Ord [X ]].compare(x, y) < 0
23
+ val less5 = [X : [X ] =>> Ord [X ]] => (x : X , y : X ) => summon[Ord [X ]].compare(x, y) < 0
24
+
25
+ val less6 = [X : {Ord , Show }] => (x : X , y : X ) => summon[Ord [X ]].compare(x, y) < 0
26
+
27
+ val less7 = [X : {Ord as ord , Show }] => (x : X , y : X ) => ord.compare(x, y) < 0
28
+
29
+ val less8 = [X : {Ord , Show as show }] => (x : X , y : X ) => summon[Ord [X ]].compare(x, y) < 0
30
+
31
+ val less9 = [X : {Ord as ord , Show as show }] => (x : X , y : X ) => ord.compare(x, y) < 0
0 commit comments