score:0

I got it working as following

type C1Str[M] = M match {
    case Int => Int
    case String => Int
}

type C1Int[M] = M match {
    case String => Int
}

type C2[N, M] = N match {
  case String => C1Str[M]
  case Int => C1Int[M]
}
 
def fn[M,N](x:N,y:M):C2[N,M] = x match {
  case x: String => y match {
    case y: Int => x.size + y
    case y: String => x.size + y.size
  }
  case x: Int => y match {
    case y: String => x + y.size
  }
}

It looks if you want to create a match type with multiple type parameters you need to make each case another match type.


Related Query