Skip to content

Instantly share code, notes, and snippets.

@jodersky
Created March 30, 2017 00:16
Show Gist options
  • Save jodersky/faf45eba5fffb2c3a766e88d8db15629 to your computer and use it in GitHub Desktop.
Save jodersky/faf45eba5fffb2c3a766e88d8db15629 to your computer and use it in GitHub Desktop.
object Main extends App {
type Succ[A] <: Shape
type _0 <: Shape
type _1 = Succ[_0]
type _2 = Succ[_1]
type _3 = Succ[_2]
type Shape
case class Matrix[M <: Shape, N <: Shape]()
def read[M <: Shape, N <: Shape](): Matrix[M, N] = ???
def sum[M <: Shape, N <: Shape](m1: Matrix[M, N], m2: Matrix[M, N]): Matrix[M, N] = ???
def multiply[M <: Shape, N <: Shape, L <: Shape](m1: Matrix[M, N], m2: Matrix[N, L]): Matrix[M, L] = ???
val m1 = Matrix[_1, _2]()
val m2 = Matrix[_2, _3]()
val m3 = Matrix[_1, _2]()
//sum(m1, m2)
sum(m1, m3)
//multiply(m1, m3)
multiply(m1, m2)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment