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( ... ) @compileTimeOnly( ... )
Linear Supertypes
Ordering
- Alphabetic
- By Inheritance
Inherited
- typeclass
- StaticAnnotation
- Annotation
- AnyRef
- Any
- Hide All
- Show All
Visibility
- Public
- All
Instance Constructors
- new typeclass(excludeParents: List[String] = Nil, generateAllOps: Boolean = true)
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
- @throws( ... )
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
-
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
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )