drop intersection types test

This commit is contained in:
Mark Canlas 2022-06-13 12:05:57 -04:00
parent f4a091a79f
commit 82eaac780e
5 changed files with 0 additions and 54 deletions

View File

@ -1,5 +0,0 @@
package com.htmlism.usingtypes
class Accumulator {
}

View File

@ -1,9 +0,0 @@
package com.htmlism.usingtypes
// cannot reconcile adding `A : Reg` when needing `Reg[A & B]`
class AsmProgram[+A]:
def join[B](that: AsmProgram[B]): AsmProgram[A & B] =
new AsmProgram
def use: Int =
4

View File

@ -1,30 +0,0 @@
package com.htmlism.usingtypes
trait Reg[+A]:
def get: A
object Reg:
given accumulatorReg: Reg[Accumulator] with
def get: Accumulator =
new Accumulator
given xReg: Reg[RegisterX] with
def get: RegisterX =
new RegisterX
given yReg: Reg[RegisterY] with
def get: RegisterY =
new RegisterY
object Playground extends App:
private val first =
new AsmProgram[Accumulator]
private val second =
new AsmProgram[RegisterX]
private val both: AsmProgram[Accumulator & RegisterX] =
first
.join(second)
println(both.use)

View File

@ -1,5 +0,0 @@
package com.htmlism.usingtypes
class RegisterX {
}

View File

@ -1,5 +0,0 @@
package com.htmlism.usingtypes
class RegisterY {
}