
com.avsystem.commons.misc.ValueOf.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of commons-core_2.13 Show documentation
Show all versions of commons-core_2.13 Show documentation
AVSystem commons library for Scala
package com.avsystem.commons
package misc
import com.avsystem.commons.macros.misc.MiscMacros
import scala.annotation.implicitNotFound
/**
* Macro materialized typeclass which captures the single value of a singleton type.
*/
@implicitNotFound("Cannot derive value of ${T} - is not a singleton type")
class ValueOf[T](val value: T) extends AnyVal
object ValueOf {
def apply[T](implicit vof: ValueOf[T]): T = vof.value
implicit def mkValueOf[T]: ValueOf[T] = macro MiscMacros.mkValueOf[T]
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy