Questions tagged [scala-2.13]

Version 2.13 of the Scala programming language. Use for questions particularly addressing features of this version of Scala.

Scala 2.13 brings improvements in

  • compiler performance
  • simplifying the collections
  • modularizing the standard library
  • user-friendliness
100 questions
4
votes
1 answer

Why implicit object has precedence over val in Scala 2.13-M5?

I'm wondering if this is a bug or an expected behaviour in Scala 2.13-M5. Following snippet compiles and outputs "object in package object": package object test { implicit val a: TS = new TS("val in package object") implicit object b extends…
Slava Schmidt
  • 296
  • 2
  • 12
3
votes
2 answers

In Scala, how to summon a polymorphic function applicable to an input type, without knowing the output type or full type arguments?

Since Scala 2.12 (or is it 2.13, can't be sure), the compiler can infer latent type arguments across multiple methods: def commutative[ A, B ]: ((A, B) => (B, A)) = {???} // implementing omitted val a = (1 -> "a") val b =…
tribbloid
  • 4,026
  • 14
  • 64
  • 103
3
votes
1 answer

Scala 2.13 migration

I am migrating Play 2.8.8 project from Scala 2.12 to 2.13. I have a really weird error in the Play routes file: method right in class Either is deprecated (since 2.13.0): Either is now right-biased, use methods directly on Either There is no .right…
Damian
  • 593
  • 6
  • 27
3
votes
2 answers

Error downloading org.scalameta:semanticdb-scalac_2.13.6:4.4.10

I recently upgraded to Scala 2.13.6 and I am seeing: Error downloading org.scalameta:semanticdb-scalac_2.13.6:4.4.10 when I try to build. I had a similar error when I upgraded to 2.13.5, but was able to add semanticdbVersion := "4.4.11" to…
Sully
  • 494
  • 1
  • 5
  • 12
3
votes
1 answer

In scala, is it possible to initialise a singleton object from a TypeTag?

Assuming that I have a class with a TypeTag: case class TypeViz[T : TypeTag]() { def getOnlyInstance = ... } Is it possible to use the TypeTag in runtime to find the value of T, if T is a singleton type? Namely: object TypeViewsSpec { val a…
tribbloid
  • 4,026
  • 14
  • 64
  • 103
3
votes
1 answer

How to transform a collection of tuples with scala 2.13

I'd like to migrate the following code from Scala 2.12 to 2.13 Given any collection of tuples Coll[(A, B)] and a method f: B => IterableOnce[C], I'd like to produce a Coll[(A, C)] by applying f on the second element of the tuple. implicit class…
Yann Moisan
  • 8,161
  • 8
  • 47
  • 91
3
votes
1 answer

In scala, how to make type class working for Aux pattern? - Part 2

This is a follow up question of: In scala, how to make type class working for Aux pattern? Considering the following example: trait Base { type Out def v: Out } object Base { type Aux[T] = Base { type Out = T } type Lt[T] =…
tribbloid
  • 4,026
  • 14
  • 64
  • 103
3
votes
2 answers

Convert Java map into Scala immutable map in Java code with Scala-2.13

I want to convert my java map into a Scala immutable map, I have a sample code that works correctly with Scala 2.12 but fails with Scala 2.13. Setup untitled14\build.sbt name := "untitled14" version := "0.1" scalaVersion :=…
Divyanshu
  • 290
  • 2
  • 9
3
votes
1 answer

How to compile code with implicits and existentials types with 2.13

upd I have a function that accepts types with existentials: trait QueryValue[V] trait QueryValueFormats { implicit object IntQueryValue extends QueryValue[Int] implicit object StringQueryValue extends QueryValue[String] } trait Magnets { …
zella
  • 4,645
  • 6
  • 35
  • 60
3
votes
0 answers

Trying to use .par in Scala 2.13 gives me “Error: value par is not a member of”

I'm learning Scala. While taking Martin Odersky's MOOC, I watched his talk at OSCON Java 2011 titled "Working Hard to Keep It Simple". In his presentation, he uses the .par method to make a collection parallel. But when I try to use .par in Scala,…
3
votes
1 answer

Gatling compatibility issue with Scala 2.13.0 in IntelliJ

Problem I'm extending an existing performance test project, which is a Scala project that uses Gatling for simulations and Maven as a build tool. I need Scalaj as a new depenency. I changed Scala version from 2.12.8 to 2.13.0 so that I could use the…
zslim
  • 441
  • 7
  • 14
3
votes
2 answers

Adding custom collection operations in scala 2.13 to arbitrary collections of specific types

Note - the operation described below now exists in the standard library as partitionMap but I believe it's still a valid question as to how to achieve more general ends Question regarding scala 2.13 - how do I consume/construct collections of…
oxbow_lakes
  • 133,303
  • 56
  • 317
  • 449
2
votes
2 answers

How to perform safe pattern matching on existential types in Scala 2.13?

Note: This is a contrived example. Consider the following existential type. sealed trait Showable final case class Show[A](show: A => String, value: A) extends Showable I can define a show method as follows: def show(showable: Showable): String =…
Aadit M Shah
  • 72,912
  • 30
  • 168
  • 299
2
votes
2 answers

What's the "-Ydebug-error" option in scala 2? it should print every stack traces of each compilation error

When I'm debugging a complex scala plugin, I sometimes encounter unknown errors, I want the compiler to print out the stacktrace that triggers each error, to make sure that those errors are not caused by my pluin. In scala 3 this option can be…
tribbloid
  • 4,026
  • 14
  • 64
  • 103
2
votes
1 answer

In scala 2, can macro or any language feature be used to rewrite the abstract type reification mechanism in all subclasses? How about scala 3?

It is known in scala 2 that macros are strictly local and are only executed once, when the class is defined. This feature seems particularly weak when combining with abstract type, as the process to convert abstract types into concrete one generally…
tribbloid
  • 4,026
  • 14
  • 64
  • 103