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
0
votes
1 answer

In scala 2.13. How to log information/warning/error reliably in macro?

I'm writing a macro that can log a short message during the compilation, using pattern matching and constant type feature of scala 2.13: class EmitMsg[T, SS <: EmitMsg.EmitLevel] {} object EmitMsg { trait EmitLevel trait Info extends…
tribbloid
  • 4,026
  • 14
  • 64
  • 103
0
votes
2 answers

In scala macro, how to lift an object and use it in quasiquote at compile time?

The following code snippet is a short scala macro bundle definition from a thoughtworks project: private[SelfType] final class Macros(val c: whitebox.Context) { import c.universe._ def apply[A: WeakTypeTag]: Tree = { val a =…
tribbloid
  • 4,026
  • 14
  • 64
  • 103
0
votes
1 answer

What is the proper way to convert Iterator to Iterable in Scala 2.13?

When upgrading the scala version of an existing code base the build warns that the .toIterable method on an Iterator is deprecated. How can an Iterator be converted to an Iterable in Scala 2.13? Intellij recommends use…
Ramón J Romero y Vigil
  • 17,373
  • 7
  • 77
  • 125
0
votes
1 answer

In scala shapeless, how to use Record.updateWith inside another method?

From what I have read online, the shapeless Record.updateWith seems to be the only way to update both the value & type of a Record entry. So I gave it a try: import shapeless.syntax.singleton.mkSingletonOps import shapeless.record._ val…
tribbloid
  • 4,026
  • 14
  • 64
  • 103
0
votes
0 answers

In scala, how to authentically get the declared type of a variable?

I recently found that the scala reflection library seems to be out of maintenance and interact poorly with a few other features, e.g. For the most simple use case, when the types of variables needs to be extracted, scala reflection can't get it…
tribbloid
  • 4,026
  • 14
  • 64
  • 103
0
votes
2 answers

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

Here is a simple example: trait Base { type Out def v: Out } object Base { type Aux[T] = Base { type Out = T } class ForH() extends Base { type Out = HNil override def v: Out = HNil } object ForH…
tribbloid
  • 4,026
  • 14
  • 64
  • 103
0
votes
2 answers

Is there anyway, in Scala, to get the Singleton type of something from the more general type?

I have a situation where I'm trying to use implicit resolution on a singleton type. This works perfectly fine if I know that singleton type at compile time: object Main { type SS = String with Singleton trait Entry[S <: SS] { type…
Ryan Stull
  • 1,056
  • 14
  • 35
0
votes
2 answers

Scala type erasure

I just would like to check for any occurrences of type T in the example bellow. Assert fails though (try me): val seq = List(AcceptableRisk, UnacceptableRisk) def any[T] = seq.collect { case x: T => x }.nonEmpty assert(any[UnknownRisk] ==…
Dmitry Nogin
  • 3,670
  • 1
  • 19
  • 35
0
votes
1 answer

scala 2.13 - error during compiling plugin

I want to create a sbt plugin this is my project build.sbt file: lazy val root = (project in file(".")). settings( name := "test-plagin", version := "0.1.0", organization := "com.test", scalaVersion := "2.13.0", sbtPlugin :=…
Slavik Muz
  • 1,157
  • 1
  • 15
  • 28
0
votes
1 answer

What is the scala 2.13 interpreter main class?

If I don't have the scala command in the PATH, or I wanted to specifically run the sbt project's scala version-- without using sbt console-- what would be the sbt runMain for scala 2.13?
SourceSimian
  • 682
  • 4
  • 18
1 2 3 4 5 6
7