scala-3 Questions
2
Solved
Currently learning about Scala 3 implicits but I'm having a hard time grasping what the as and with keywords do in a definition like this:
given listOrdering[A](using ord: Ordering[A]) as Ordering...
2
Solved
Suppose that I have some typeclass
trait FooBar[X]
and an instance of FooBar[Int]:
given intIsFooBar: FooBar[Int] = new FooBar {}
Now, suppose that I have an interface Intf that has some member t...
Virgil asked 21/3, 2023 at 21:31
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
If I have an arbitrary type union in Scala 3, is it possible to write a method that "removes" one type from the union?
Similar to shapeless.ops.coproduct.Remove, but for native Scala 3.
F...
Herrle asked 3/7, 2022 at 16:33
0
This is both a question and a poll. Considering the following case:
trait Mat[+T]
implicitly[Mat[Product] =:= Mat[_ <: Product]]
/* Compiler error:
: Cannot prove that com.tribbloids.spike.d...
Exponible asked 7/5, 2023 at 18:31
2
Solved
I am coding using scala3, leveraging programmatic structural types.
The structural types happen to mimic existing case classes:
their definition is pure boiler plate,
hence the temptation to craft ...
Pernas asked 23/11, 2022 at 15:42
1
Scala 3.3.0-RC2 has added MacroAnnotation but it has a ton of caveats. The main on is that "new definitions will not be visible from outside the macro expansion".
There are a lot of examp...
Gonocyte asked 13/4, 2023 at 2:39
2
Solved
Here is a short example in Scala 3:
type Ext[S <: Seq[_]] = S match {
case Seq[t] => t
}
trait XX[A, B <: Seq[A]]
trait XX1[B <: Seq[_]] extends XX[Ext[B], B]
So far it appears t...
Zanazander asked 24/3, 2023 at 20:9
1
how to generate a private parameterless constructor on a class (at compile time) when it annotated with @entity
annotation - in scala 3 macros
class entity extends scala.annotation.StaticAnnotation...
Scarabaeid asked 18/1, 2023 at 12:15
2
Solved
The following is a quote from Macros: the Plan for Scala 3 from more than 3 years ago:
For instance, one will be able to define a macro annotation @json that adds a JSON serializer to a type.
Any...
Enharmonic asked 31/5, 2021 at 9:13
1
Solved
How can I impletement type-level operations (addition in this case) in Scala 3 ?
Here is what I would like to do (this does not compile) :
case class foo[S <: Int & Singleton](value: Double)...
Tektite asked 17/3, 2023 at 10:4
2
What means this exception and how can I fix it?
scalac: Token not found: /Users/mpa/Library/Caches/JetBrains/IntelliJIdea2021.3/compile-server/tokens/54149
I have a Scala 3 project in IntelliJ 202...
Equally asked 6/3, 2022 at 13:14
2
Solved
Scala3 has support for "kind polymorphism". Docs also mention AnyKind type:
AnyKind plays a special role in Scala's subtype system: It is a supertype of all other types no matter what th...
Mingrelian asked 18/2, 2023 at 14:47
1
Solved
Learning Scala 3.
how can i make this code type-match and compile?
trait Key {
type Value
}
object Name extends Key {
type Value = String
}
object Age extends Key {
type Value = Int
}
type D...
Washerman asked 17/2, 2023 at 15:10
1
I'm trying to take an arbitrary tuple of Futures and return a tuple of the completed future's values, while providing a time limit for the completion of the futures. I'm trying to use Tuple's provi...
Sizar asked 16/2, 2023 at 4:36
1
Here is a simple example:
object MatchErasedType {
trait Supe {
self: Singleton =>
type T1
lazy val default: T1
def process(v: Any): T1 = {
v match {
case vv: T1 => vv
case _ =>...
Benevento asked 11/2, 2023 at 21:28
1
Solved
Trying to grasp Scala 3 type system.
Question:
Is it possible to write a single universal def curry(f: ???) = ... function that accepts f of any arity and returns a curried fn? No compiler plugins...
Hypaesthesia asked 11/2, 2023 at 7:4
1
Solved
I'm trying to zip tuples together and use match types to get the exact type of the resulting zip. I have a match type and the function:
type Z[A <: Tuple, B <: Tuple] <: Tuple = (A, B) ma...
Human asked 5/2, 2023 at 20:48
0
(This question is under a permanent bounty of 1000 points, once proven/refuted, it will be retrospectively set up and awarded)
(Possible duplicate: https://math.stackexchange.com/questions/4232108/...
Zippel asked 31/1, 2023 at 1:12
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
2
In this article, it is explained that each generic type argument in Scala 3 code is perceived as a dependent type to be conform with the DOT logic:
https://dotty.epfl.ch/docs/internals/higher-kinde...
Bipartite asked 6/1, 2023 at 20:32
1
Solved
1
Solved
In Scala 3 I can define a functor for state using type lambda:
given stateFunctor[S]: Functor[[A] =>> State[S, A]] with
override def map[A, B](a: State[S, A])(fx: A => B): State[S, B] = ...
Alina asked 31/10, 2022 at 18:21
1
Solved
I'm trying to run an example from the Spark book Spark: The Definitive Guide
build.sbt
ThisBuild / scalaVersion := "3.2.1"
libraryDependencies ++= Seq(
("org.apache.spark" %% ...
Rubella asked 30/10, 2022 at 0:57
1
I'm pretty new to Scala programming. I pulled a code from GIT into IntelliJ. However, I'm getting the below error while compiling. I have installed latest Scala version (3.2.0) on to my mac (JDK18 ...
Pompei asked 6/10, 2022 at 14:45
1 Next >
© 2022 - 2025 — McMap. All rights reserved.