Packages

c

simulacrum

typeclass

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 for implicitly[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 extends Ops and the Ops traits for any super types.
  • a trait, named ToMyTypeClassOps, which provides an implicit conversion that enables use of the Ops trait.
  • an object, named ops, which provides an implicit conversion to the AllOps 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
StaticAnnotation, Annotation, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. typeclass
  2. StaticAnnotation
  3. Annotation
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new typeclass(excludeParents: List[String] = Nil, generateAllOps: Boolean = true)

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  6. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  7. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  8. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  9. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
  10. def hashCode(): Int
    Definition Classes
    AnyRef → Any
  11. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  12. macro def macroTransform(annottees: Any*): Any
  13. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  14. final def notify(): Unit
    Definition Classes
    AnyRef
  15. final def notifyAll(): Unit
    Definition Classes
    AnyRef
  16. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  17. def toString(): String
    Definition Classes
    AnyRef → Any
  18. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  19. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  20. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from StaticAnnotation

Inherited from Annotation

Inherited from AnyRef

Inherited from Any

Ungrouped