Package

julienrf

enum

Permalink

package enum

Visibility
  1. Public
  2. All

Type Members

  1. class Values[A] extends AnyRef

    Permalink

    A typeclass giving the values of an enumeration

    A typeclass giving the values of an enumeration

    Annotations
    @implicitNotFound( ... )

Value Members

  1. object Values

    Permalink

    The companion object contains the machinery to automatically derive the values of a sealed trait extended by case objects only.

    The companion object contains the machinery to automatically derive the values of a sealed trait extended by case objects only.

    Basically, the derivation process is the following:

    • we are given a sort of list containing the types of the case objects that extend a sealed trait A ;
    • we inductively traverse this structure using two implicit definitions: one for the empty list case and one for the “cons” case ;
    • we accumulate the traversed case objects in a List ;
    • that’s it: the resulting List contains all the possible values of type A.

    The first step is the hard part of this process and is actually achieved by shapeless (using macros).

Ungrouped