File tree 1 file changed +38
-0
lines changed
1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change
1
+ // Copied from Scalaz - http://scalaz.googlecode.com/svn/continuous/latest/browse.sxr/scalaz/PartialApplys.scala.html
2
+ trait PartialApply1Of2 [T [_, _], A ] {
3
+ type Apply [B ] = T [A , B ]
4
+
5
+ type Flip [B ] = T [B , A ]
6
+ }
7
+
8
+ object Test {
9
+ trait TypeWithHigherKindParam [D [_]]
10
+ implicit def function [D [_]](t : TypeWithHigherKindParam [D ]) = 1
11
+ val param : TypeWithHigherKindParam [PartialApply1Of2 [Tuple2 , Int ]# Apply ] = null
12
+
13
+ function[PartialApply1Of2 [Tuple2 , Int ]# Apply ](param): Int // Compiles
14
+ function(param) // Does not compile
15
+ param : Int // Does not compile
16
+ }
17
+
18
+ object Test2 {
19
+ // More complex variations of the same problem:
20
+ trait Exp [+ T ]
21
+
22
+ trait TypeWithHigherKindParam [D [_]]
23
+ def function [D [_]](t : Exp [TypeWithHigherKindParam [D ]]) = null
24
+ val param : Exp [TypeWithHigherKindParam [PartialApply1Of2 [Tuple2 , Int ]# Apply ]] = null
25
+ function[PartialApply1Of2 [Tuple2 , Int ]# Apply ](param)
26
+ function(param)
27
+ }
28
+
29
+ object Test3 {
30
+ trait Exp [+ T ]
31
+
32
+ trait TypeWithHigherKindParam [C [X ] <: Traversable [X ], D [_]]
33
+
34
+ def function [C [X ] <: Traversable [X ], D [_]](t : Exp [TypeWithHigherKindParam [C ,D ]]) = null
35
+ val param : Exp [TypeWithHigherKindParam [Traversable , PartialApply1Of2 [Tuple2 , Int ]# Apply ]] = null
36
+ function[Traversable , PartialApply1Of2 [Tuple2 , Int ]# Apply ](param)
37
+ function(param)
38
+ }
You can’t perform that action at this time.
0 commit comments