Package

caseapp

util

Permalink

package util

Visibility
  1. Public
  2. All

Type Members

  1. trait Annotation[A, T] extends Serializable

    Permalink

    Evidence that type T has annotation A, and provides an instance of the annotation.

    Evidence that type T has annotation A, and provides an instance of the annotation.

    If type T has an annotation of type A, then an implicit Annotation[A, T] can be found, and its apply method provides an instance of the annotation.

    Example:

    case class First(i: Int)
    
    @First(3) trait Something
    
    
    val somethingFirst = Annotation[First, Something].apply()
    assert(somethingFirst == First(3))
  2. trait AnnotationList[A, T] extends DepFn0 with Serializable

    Permalink
  3. class AnnotationListMacros extends CaseClassMacros

    Permalink
  4. class AnnotationMacros extends CaseClassMacros

    Permalink
  5. trait AnnotationOption[A, T] extends AnyRef

    Permalink
  6. trait Annotations[A, T] extends DepFn0 with Serializable

    Permalink

    Provides the annotations of type A of the fields or constructors of case class-like or sum type T.

    Provides the annotations of type A of the fields or constructors of case class-like or sum type T.

    If type T is case class-like, this type class inspects its fields and provides their annotations of type A. If type T is a sum type, its constructor types are looked for annotations.

    Type Out is an HList having the same number of elements as T (number of fields of T if T is case class-like, or number of constructors of T if it is a sum type). It is made of None.type (no annotation on corresponding field or constructor) and Some[A] (corresponding field or constructor is annotated).

    Method apply provides an HList of type Out made of None (corresponding field or constructor not annotated) or Some(annotation) (corresponding field or constructor has annotation annotation).

    Note that annotation types must be case class-like for this type class to take them into account.

    Example:

    case class First(s: String)
    
    case class CC(i: Int, @First("a") s: String)
    
    sealed trait Base
    @First("b") case class BaseI(i: Int) extends Base
    case class BaseS(s: String) extends Base
    
    
    val ccFirsts = Annotations[First, CC]
    val baseFirsts = Annotations[First, Base]
    
    // ccFirsts.Out is  None.type :: Some[First] :: HNil
    // ccFirsts.apply() is
    //   None :: Some(First("a")) :: HNil
    
    // baseFirsts.Out is  Some[First] :: None.type :: HNil
    // baseFirsts.apply() is
    //   Some(First("b")) :: None :: HNil
  7. trait Default[T] extends DepFn0 with Serializable

    Permalink

    Provides default values of case class-like types.

    Provides default values of case class-like types.

    The Out type parameter is an HList type whose length is the number of fields of T. Its elements correspond to the fields of T, in their original order. It is made of None.type (no default value for this field) and Some[...] (default value available for this field, with ... the type of the field). Note that None.type and Some[...] are more precise than simply Option[...], so that the availability of default values can be used in type level calculations.

    The apply method returns an HList of type Out, with None elements corresponding to no default value available, and Some(defaultValue) to default value available for the corresponding fields.

    Use like

    case class CC(i: Int, s: String = "b")
    
    val default = Default[CC]
    
    // default.Out is  None.type :: Some[String] :: HNil
    
    // default() returns
    //   None :: Some("b") :: HNil,
    // typed as default.Out
  8. class DefaultMacros extends CaseClassMacros

    Permalink
  9. trait Implicit[T] extends AnyRef

    Permalink
  10. trait LowPriorityAnnotationOption extends AnyRef

    Permalink
  11. trait LowPriorityImplicit extends AnyRef

    Permalink

Value Members

  1. object Annotation extends Serializable

    Permalink
  2. object AnnotationList extends Serializable

    Permalink
  3. object AnnotationOption extends LowPriorityAnnotationOption

    Permalink
  4. object Annotations extends Serializable

    Permalink
  5. object Default extends Serializable

    Permalink
  6. object Implicit extends LowPriorityImplicit

    Permalink

Ungrouped