All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.getquill.util.Show.scala Maven / Gradle / Ivy

There is a newer version: 1.4.0
Show newest version
package io.getquill.util

object Show {
  trait Show[T] {
    def show(v: T): String
  }

  object Show {
    def apply[T](f: T => String) = new Show[T] {
      def show(v: T) = f(v)
    }
  }

  implicit class Shower[T](v: T)(implicit shower: Show[T]) {
    def show = shower.show(v)
  }

  implicit def listShow[T](implicit shower: Show[T]) = Show[List[T]] {
    case list => list.map(_.show).mkString(", ")
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy