Package fj.data.hlist

Class HList.HFoldr<G,​V,​L,​R>

  • Type Parameters:
    G - The type of the function with which to fold.
    V - The type of the value to be substituted for the empty list.
    L - The type of the heterogeneous list to be folded.
    R - The return type of the fold.
    Enclosing class:
    HList<A extends HList<A>>

    public static final class HList.HFoldr<G,​V,​L,​R>
    extends java.lang.Object
    The catamorphism over heterogeneous lists.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private F3<G,​V,​L,​R> foldRight  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private HFoldr​(F3<G,​V,​L,​R> foldRight)  
    • Field Detail

      • foldRight

        private final F3<G,​V,​L,​R> foldRight
    • Constructor Detail

      • HFoldr

        private HFoldr​(F3<G,​V,​L,​R> foldRight)
    • Method Detail

      • hFoldr

        public static <G,​V> HList.HFoldr<G,​V,​HList.HNil,​V> hFoldr()
        A fold instance for the empty list.
        Type Parameters:
        G - The type of the function with which to fold.
        V - The type of value that this fold returns.
        Returns:
        a fold instance for the empty list.
      • hFoldr

        public static <E,​G,​V,​L extends HList<L>,​R,​RR,​H extends HList.HFoldr<G,​V,​L,​R>,​PP extends HList.Apply<G,​P2<E,​R>,​RR>> HList.HFoldr<G,​V,​HList.HCons<E,​L>,​RR> hFoldr​(PP p,
                                                                                                                                                                                                                                                                              H h)
        A fold instance for a non-empty heterogeneous list
        Type Parameters:
        E - The type of the head of the list.
        G - The type of function to apply to the head of the list and the fold of its tail.
        V - The type of value to substitute for the empty list.
        L - The type of the tail of the list.
        R - The type of the fold of the tail of the list.
        RR - The return type of the fold.
        H - The type of the fold instance for the tail of the list.
        PP - The type of the given function application operator.
        Parameters:
        p - An operator that applies a function on the head of the list and the fold of its tail.
        h - A fold instance for the tail of the list.
        Returns:
        A fold instance for a non-empty heterogeneous list.
      • foldRight

        public R foldRight​(G f,
                           V v,
                           L l)
        Folds a non-empty heterogeneous list.
        Parameters:
        f - A function with which to fold.
        v - The value to substitute for the empty list.
        l - The heterogeneous list to be folded.
        Returns:
        a value obtained by folding the given list with the given function.