type-projection Questions

2

Solved

I'm trying to migrate a library from Scala 2.13 to Scala 3, but the existing code does not compile. Here is a snippet trait Identity trait Authenticator trait Env { type I <: Identity type A ...
Bernabernadene asked 22/11, 2023 at 15:52

1

This code does not compile in Scala 3 since type projection on an abstract type is now invalid: trait Entity: type Key type Dictionary[T <: Entity] = Map[T#Key, T] The compiler complains tha...
Super asked 24/1, 2023 at 20:47

1

Solved

I always thought that context bounds and implicit parameter lists behaved exactly the same, but apparently not. In the example below, I expect summon1[Int] and summon2[Int] to return the same type,...

2

Solved

A simple value hierarchy Imagine this simple trait Value where every implementing class has a value of some type T. trait Value { type T def value: T } We have two different implementing clas...
Reinhold asked 29/11, 2019 at 9:0

1

I have been reading about Dotty, since it looks like it is about to become scala 3, and noticed that type projections are deemed "unsound" and removed from the language ... This seems like a bumme...
Indetermination asked 26/4, 2018 at 12:58

1

Solved

Consider the following: trait Foo { type F[_] type A type FA = F[A] def get: FA } class SeqStringFoo extends Foo { type F[_] = Seq[_] type A = String def get: Seq[String] = Seq("hello worl...
Rusticus asked 25/11, 2015 at 13:27

1

I'd like to pass an object to a function that accepts an argument with a projected type, and get Scala to deduce that the object's type comes from the object that encloses it. Here's some simple co...

2

Solved

Could someone explain how the type keyword and # operator works in scala and how to use it? Please look at examples. //Example1 scala> type t1 = Option.type defined type alias t1 //Shouldn't t...
Rheumatoid asked 18/10, 2012 at 16:35

2

Solved

I have some troubles having Scala to infer the right type from a type projection. Consider the following: trait Foo { type X } trait Bar extends Foo { type X = String } def baz[F <: Foo](x...
Schonfield asked 6/2, 2013 at 3:45

4

I would like to move a type parameter to a type member. This is the starting point which works: trait Sys[S <: Sys[S]] { type Tx type Id <: Identifier[S#Tx] } trait Identifier[Tx] { def...
Mannos asked 8/1, 2013 at 23:4

2

While cracking my head over another question, I came across different riddles which seem related. This is one of them: trait Sys[S <: Sys[S]] { type Peer <: Sys[Peer] } trait Fenced { typ...

3

Solved

Why does this Scala code fail to typecheck? trait T { type A } trait GenFoo[A0, S <: T { type A = A0 }] trait Foo[S <: T] extends GenFoo[S#A, S] I don't understand why "type arguments [S#A...
Macias asked 22/7, 2011 at 20:17
1

© 2022 - 2024 — McMap. All rights reserved.