Class HListLens

java.lang.Object
com.jnape.palatable.lambda.optics.lenses.HListLens

public final class HListLens extends Object
Lenses that operate on HLists.
  • Constructor Details

    • HListLens

      public HListLens()
  • Method Details

    • elementAt

      public static <E, List extends HList.HCons<?, ?>> Lens.Simple<List,E> elementAt(Index<E,List> index)
      Focus invariantly on the element at the specified Index in an HList.
      Type Parameters:
      E - the element type
      List - the HList under focus
      Parameters:
      index - the index of the element to focus on
      Returns:
      a lens focusing on the element at index
    • head

      public static <Head, Tail extends HList> Lens.Simple<HList.HCons<Head,? extends Tail>,Head> head()
      Focus on the head of an HList.
      Type Parameters:
      Head - the head element type
      Tail - the tail HList type
      Returns:
      a lens that focuses on the head of an HList
    • tail

      public static <Head, Tail extends HList> Lens.Simple<HList.HCons<Head,? extends Tail>,Tail> tail()
      Focus on the tail of an HList.
      Type Parameters:
      Head - the head element type
      Tail - the tail HList type
      Returns:
      a lens that focuses on the tail of an HList