Packages

p

simulacrum

package simulacrum

Type Members

  1. class TypeClassMacros extends AnyRef
  2. class noop extends Annotation with StaticAnnotation

    Annotation that may be applied to methods on a type that is annotated with @typeclass.

    Annotation that may be applied to methods on a type that is annotated with @typeclass.

    Doing so results in the method being excluded from the generated syntax ops type.

    Annotations
    @compileTimeOnly( ... )
  3. class op extends Annotation with StaticAnnotation

    Annotation that may be applied to methods on a type that is annotated with @typeclass.

    Annotation that may be applied to methods on a type that is annotated with @typeclass.

    Doing so changes the code generation strategy used when generating the syntax ops type. Instead of the type class method name being used, the name specified on this annotation is used. If alias is true, two methods are generated, one with the original name and one with the specified name.

    Annotations
    @compileTimeOnly( ... )
  4. 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.

    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( ... )

Ungrouped