@@ -31,11 +31,22 @@ package object cats {
3131 * type `A` to get a pure value of type `B`. That is, the instance
3232 * encodes pure unary function application.
3333 */
34- type Id [A ] = A
34+ type Id [+ A ] = A
35+
36+ // Workaround for a compiler bug that should be fixed soon.
37+ private type IdWrapper = { type L [+ A ] = A }
38+
3539 type Endo [A ] = A => A
36- implicit val catsInstancesForId
37- : Bimonad [Id ] with CommutativeMonad [Id ] with Comonad [Id ] with NonEmptyTraverse [Id ] with Distributive [Id ] =
38- new Bimonad [Id ] with CommutativeMonad [Id ] with Comonad [Id ] with NonEmptyTraverse [Id ] with Distributive [Id ] {
40+ implicit val catsInstancesForId : Bimonad [IdWrapper # L ]
41+ with CommutativeMonad [IdWrapper # L ]
42+ with Comonad [IdWrapper # L ]
43+ with NonEmptyTraverse [IdWrapper # L ]
44+ with Distributive [IdWrapper # L ] =
45+ new Bimonad [IdWrapper # L ]
46+ with CommutativeMonad [IdWrapper # L ]
47+ with Comonad [IdWrapper # L ]
48+ with NonEmptyTraverse [IdWrapper # L ]
49+ with Distributive [IdWrapper # L ] {
3950 def pure [A ](a : A ): A = a
4051 def extract [A ](a : A ): A = a
4152 def flatMap [A , B ](a : A )(f : A => B ): B = f(a)
@@ -81,16 +92,18 @@ package object cats {
8192 /**
8293 * Witness for: Id[A] <-> Unit => A
8394 */
84- implicit val catsRepresentableForId : Representable .Aux [Id , Unit ] = new Representable [Id ] {
85- override type Representation = Unit
86- override val F : Functor [Id ] = Functor [Id ]
95+ implicit val catsRepresentableForId : Representable .Aux [IdWrapper # L , Unit ] =
96+ new Representable [IdWrapper # L ] {
97+ override type Representation = Unit
98+ override val F : Functor [Id ] = Functor [Id ]
8799
88- override def tabulate [A ](f : Unit => A ): Id [A ] = f(())
100+ override def tabulate [A ](f : Unit => A ): Id [A ] = f(())
89101
90- override def index [A ](f : Id [A ]): Unit => A = (_ : Unit ) => f
91- }
102+ override def index [A ](f : Id [A ]): Unit => A = (_ : Unit ) => f
103+ }
92104
93- implicit val catsParallelForId : Parallel .Aux [Id , Id ] = Parallel .identity
105+ implicit val catsParallelForId : Parallel .Aux [IdWrapper # L , IdWrapper # L ] =
106+ Parallel .identity[Id ]
94107
95108 type Eq [A ] = cats.kernel.Eq [A ]
96109 type PartialOrder [A ] = cats.kernel.PartialOrder [A ]
0 commit comments