Implicit conversion on type alias does not seem to work on his code

Viewed 65
    trait TriIndexable[M[_,_,_,_]] {
      def get[A,B,C,D](m: M[A,B,C,D])(a: A, b: B, c: C): Unit
    }
    implicit object TriMapTriIndexable extends TriIndexable[TriMap] {
      def get[A,B,C,D](m: TriMap[A,B,C,D])(a: A, b: B, c: C): Unit = {
        println("Tri indexable get")
      }
    }
    type TriIntMap[D] = TriMap[Int,Int,Int,D]
    trait TupleIntIndexable[M[_]] {
      def get[D](m: M[D])(a: (Int, Int, Int)): Unit
    }
    implicit object TriIntMapTupleIntIndexable extends TupleIntIndexable[TriIntMap] {
        def get[D](m: TriIntMap[D])(a: (Int, Int, Int)): Unit = {
        println("Tri Int indexable get")
      }
    }
    class TriMap[A,B,C,D]() {
    }
    implicit class TriIndexableOps[A,B,C,D,M[_,_,_,_]](
          val tri: M[A,B,C,D]
    )(implicit ev: TriIndexable[M]) {
        def get(a: A, b: B, c: C) = {
        ev.get(tri)(a,b,c)
    }
    }
    implicit class TupleIntIndexableOps[D,M[_]](
          val tri: M[D]
    )(implicit ev: TupleIntIndexable[M]) {
        def get(a: (Int,Int,Int)) = {
        ev.get(tri)(a)
    }
    }
    val test: TriIntMap[String] = new TriMap[Int,Int,Int,String]()
    test.get(5,5,5)
    test.get((5,5,5))

not enough arguments for method get: (a: Int, b: Int, c: Int): Unit. Unspecified value parameters b, c.

Why does this error on the last line? I'm trying to give a subset of TriMaps the ability to index with another object, in this case it's a tuple of three ints. How can I fix this?

https://scastie.scala-lang.org/pMEa7Zq6TLeBxq1k9zG1oA

0 Answers
Related