match-types Questions
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
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
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
Let's say I want to represent a vector using a matched type like this:
type V[I <: Int, N] = I match
case 2 => (N, N)
case 3 => (N, N, N)
case 4 => (N, N, N, N)
so now I can declare...
Flier asked 28/11, 2021 at 1:4
0
Given:
abstract class Quantity[A <: Quantity[A]]
sealed trait UnitOfMeasure[A]
class Time extends Quantity[Time]
object Minutes extends UnitOfMeasure[Time]
class PowerRamp extends Quantity[Pow...
Mewl asked 22/8, 2021 at 1:51
1
Solved
I'm learning Scala 3, and I was intrigued by match types and literal types.
I'd like to write a function that takes one of a few literal types, and returns a particular type as a function of which ...
Goodyear asked 6/8, 2021 at 22:17
1
Solved
I was very curious to see if I could port my untyped project to be typed with Scala 3.
Here was my start:
object Main {
type HtmlNodeRecord[X]= X match {
case "tag" => String
case &...
Teide asked 19/10, 2020 at 19:43
1
Solved
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 ...
Heidt asked 21/8, 2020 at 23:46
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
© 2022 - 2024 — McMap. All rights reserved.