com.jnape.palatable.lambda.adt.hlist

## Class Index<Target,TargetList extends HList.HCons<?,?>>

- java.lang.Object
- - com.jnape.palatable.lambda.adt.hlist.Index<Target,TargetList>

- Type Parameters:
    `Target` - the target element type
    `TargetList` - type of compatible HList

      public abstract class Index<Target,TargetList extends HList.HCons<?,?>>
      extends Object

  HList indexes representing a value at arbitrary depth in some compatible HList. HList compatibility requires identical element types up to and including the target element, but thereafter is unconstrained in length and element type.

- - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `<NewHead> Index<Target,HList.HCons<NewHead,? extends TargetList>>` | `after()` Nest this index deeper by one element.
    `abstract Target` | `get(TargetList hList)` Retrieve the value at this index in hList.
    `static <Target> Index<Target,HList.HCons<Target,?>>` | `index()` Create a root index for a head value of type `Target`.
    `abstract <L extends TargetList> L` | `set(Target newElement, L hList)` Set a new value of the same type at this index in an `HList`.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### after

          public final <NewHead> Index<Target,HList.HCons<NewHead,? extends TargetList>> after()

      Nest this index deeper by one element.
      Type Parameters:
        `NewHead` - the type of the preceding element
      Returns:
        an index at the same Target, nested one level deep

    - #### get

          public abstract Target get(TargetList hList)

      Retrieve the value at this index in hList.
      Parameters:
        `hList` - the hList
      Returns:
        the value at this index

    - #### set

          public abstract <L extends TargetList> L set(Target newElement,
                                                       L hList)

      Set a new value of the same type at this index in an `HList`.
      Type Parameters:
        `L` - the inferred tail type of the HList
      Parameters:
        `newElement` - the new value
        `hList` - the HList
      Returns:
        the updated HList

    - #### index

          public static <Target> Index<Target,HList.HCons<Target,?>> index()

      Create a root index for a head value of type `Target`.
      Type Parameters:
        `Target` - the type of the value to get
      Returns:
        the root index