Packages

a

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("typeclass annotation should have been removed by simulacrum but was not")
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

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
    @native() @HotSpotIntrinsicCandidate() @throws(classOf[java.lang.CloneNotSupportedException])
  6. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  7. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  8. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  9. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  10. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  11. macro def macroTransform(annottees: Any*): Any
  12. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  13. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  14. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  15. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  16. def toString(): String
    Definition Classes
    AnyRef → Any
  17. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  18. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @throws(classOf[java.lang.InterruptedException])
  19. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @Deprecated @deprecated @throws(classOf[java.lang.Throwable])
    Deprecated

    (Since version ) see corresponding Javadoc for more information.

Inherited from StaticAnnotation

Inherited from Annotation

Inherited from AnyRef

Inherited from Any

Ungrouped