macro class typeclass extends Annotation with StaticAnnotation
Annotation that may be applied to a trait or class of one type parameter to generate boilerplate that makes the type class easier to use.
The only type parameter must either by a proper type or a unary type constructor. Types of other shapes, like binary type constructors, are not currently supported.
As a result of adding this annotation, the following code is generated in the companion:
- an implicit summoning method, providing syntax like
MyTypeClass[Type]
as a shortcut forimplicitly[MyTypeClass[Type]]
. - a trait, named
Ops
, which provides object oriented style forwarding methods -- aka, syntax -- for the methods defined directly on the type class. - a trait, named
AllOps
, which extendsOps
and theOps
traits for any super types. - a trait, named
ToMyTypeClassOps
, which provides an implicit conversion that enables use of theOps
trait. - an object, named
ops
, which provides an implicit conversion to theAllOps
trait.
As a result, the ops can be used by either importing MyTypeClass.ops._
or
by mixing MyTypeClass.ToMyTypeClassOps
in to a type.
- Annotations
- @compileTimeOnly("typeclass annotation should have been removed by simulacrum but was not")
Linear Supertypes
Ordering
- Alphabetic
- By Inheritance
Inherited
- typeclass
- StaticAnnotation
- Annotation
- AnyRef
- Any
- Hide All
- Show All
Visibility
- Public
- All
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##(): Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate() @throws(classOf[java.lang.CloneNotSupportedException])
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- macro def macroTransform(annottees: Any*): Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws(classOf[java.lang.InterruptedException])
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])