Questions tagged [dotty]

Please use the [scala-3] tag for new questions about Scala 3. Dotty was a platform to try out new language concepts and compiler technologies for Scala. The theory behind these constructors is researched in DOT, a calculus for dependent object types. Most of these new technologies were incorporated into Scala 3.

Definition:

Dotty is both the name for a new compiler, as well as an umbrella term for new language concepts, that are slated to become Scala 3. The underlying theory is the calculus of dependent object types, or DOT in short. It is under active research.

Example Installation:

brew install lampepfl/brew/dotty

Important Links:

106 questions
6
votes
1 answer

How to unpack the type of elements in tuple in dotty?

Suppose I have a class defined as: case class Box[A](a: A) I want to write a generic method that unpack tuple (Box[A1](a1), .., Box[An](an)) to a tuple (a1, .., an) with type (A1, .., An). I tried with Match Types with no luck: scala> type…
esse
  • 1,415
  • 5
  • 10
6
votes
2 answers

Will Scala 3 not be Turing complete?

I attended the following keynote on the future of Scala by Martin Odersky: https://skillsmatter.com/skillscasts/8866-from-dot-to-dotty At 1:01:00 an answer to an audience question seems to say that future Scala will not be Turing complete. Did I…
Mario Galic
  • 47,285
  • 6
  • 56
  • 98
5
votes
1 answer

Scala3 extensions for basic types and overriding ==

Learning the Scala3 extension and CanEqual concepts, but finding difficulty in extending certain features of an Int. In the following example I am easily able to add >= functionality to Int to compare it to a RationalNumber case class, but unable to…
aldudalski
  • 63
  • 5
5
votes
2 answers

How to implement types like MapK in Scala 3 / Dotty?

I am trying and failing to get something like this to work in Scala 3: type TupleK[K[*], V[*], A] = (K[A], V[A]) final class MapK[K[*], V[*]] private (val rawMap: Map[K[?], V[?]]) { def foreach(f: TupleK[K, V, ?] => Unit): Unit = { …
Nikita
  • 2,924
  • 1
  • 19
  • 25
5
votes
1 answer

How to ensure tuple is homogenous?

For reasons beyond my control, my method receives inputs in the form of a tuple. This tuple should only contain instances of Foo, i.e., it should look like (Foo, Foo ... Foo) and should not have String or Int inside. I want to check this at…
user
  • 7,435
  • 3
  • 14
  • 44
5
votes
1 answer

How to implement the SKI combinator calculus with match types?

I was trying to implement the SKI combinator calculus in Dotty using match types. A quick description of the SKI combinator calculus: S, K, and I are terms (xy) is a term if x and y are terms and is like function application (((Sx)y)z) (same…
user
  • 7,435
  • 3
  • 14
  • 44
5
votes
1 answer

How to execute dotty code from Visual Studio Code UI

I'm trying to use Visual Studio Code to run dotty code. I started IDE using sbt launchIDE according to the instruction from this page, and I also installed Dotty Language Server and Code Runner extensions. Dotty is installed using brew and I can…
Bogdan Vakulenko
  • 3,380
  • 1
  • 10
  • 25
4
votes
1 answer

Scala 3 - Extract Tuple of wrappers and InverseMap on First Order Type

I am trying to create a function, which takes a tuple of higher-kinded types and applies a function to the types within the higher-kinded types. In the example below, there is a trait Get[A] which is our higher-kinded type. There is also a tuple of…
Travis Stevens
  • 2,198
  • 2
  • 17
  • 25
4
votes
2 answers

Type inference changes in Scala 3

What changes in type inference will Scala 3 bring? Currently documentation simply states TODO. For example, Weak conformance Scala 2.13 scala> val i: Int = 42 val i: Int = 42 scala> val c: Char = 'a' val c: Char = a scala> List(i,c) val res0:…
Mario Galic
  • 47,285
  • 6
  • 56
  • 98
4
votes
3 answers

Scala / Dotty - Mix a trait into an EXISTING object

Is there a way to mix a trait into an existing object in either Dotty or Scala? class SomeClass trait SomeTrait // This works, but it's not what I'm looking for: new SomeClass with SomeTrait // This is what I'm looking for, but it breaks: val…
xyz2006tor
  • 43
  • 2
4
votes
1 answer

How do I write a match type pattern with a narrowed String type head of tuple case in dotty?

I am currently try to get a feeling of the new features in Scala 3/dotty. So I am trying to redo something I tried with shapeless before. Given a heterogenous list of narrowed string types (in shapeless it would be "a" :: "c" :: "f" :: HNil and in…
ciuncan
  • 1,062
  • 2
  • 11
  • 25
4
votes
1 answer

Generate functions at macros expansion time

I would like to generate functions for a class accepting 1 type parameter case class C[T] (t: T) depending on the T type parameter. The functions I would like to generate are derived by the functions available on T. What I would like exactly, is to…
user2468425
  • 419
  • 2
  • 13
4
votes
1 answer

Run Scala Dotty project using Intellij IDE

I created a basic Scala Dotty project using Dotty template and import the project to IntelliJ IDE. Everything works fine when I use the sbt command line. When I try to build or run it inside IntelliJ IDE, I got following errors: Error:scalac:…
ttt
  • 3,934
  • 8
  • 46
  • 85
4
votes
1 answer

Is there a relationship between the Scala Dotty Compiler and the Dependent Objects project by Nada Amin?

We've seen Martin Odersky announce the Dotty Compiler - a possible future compiler for Scala without all the baggage. We've also seen Nada Amin release the Dependent Object Types Calculus (Dot Calculus) which has been implemented in Scala. My…
hawkeye
  • 34,745
  • 30
  • 150
  • 304
3
votes
1 answer

In Scala 3 with DOT calculus, is `this.type` a path-dependent type? What makes it special?

This question is derived from: Scala: Abstract types vs generics In Scala 3, a path-dependent type is a type/bound that binds term(s)/object(s) with a distinct compile-time path signature. As a result, once it is defined (with its upper bound ==…
tribbloid
  • 4,026
  • 14
  • 64
  • 103