static void FoldrExample() { var functions = HList.Single <Func <int, int> >(x => x + 1) .Extend <Func <int, int> >(y => y * 2) .Extend <Func <string, int> >(z => z.Length); var comp1 = Apply.Comp <string, int, int>(); var comp0 = Apply.Comp <int, int, int>(); var fold0 = HFoldr.Hfoldr <Unit, Func <int, int> >(); var fold2 = HFoldr.Hfoldr <Unit, Func <int, int>, Func <string, int>, HCons <Func <int, int>, HCons <Func <int, int>, HNil> >, Func <int, int>, Func <string, int>, Apply <Unit, Tuple <Func <string, int>, Func <int, int> >, Func <string, int> >, HFoldr <Unit, Func <int, int>, HCons <Func <int, int>, HCons <Func <int, int>, HNil> >, Func <int, int> > >(comp1, HFoldr.Hfoldr <Unit, Func <int, int>, Func <int, int>, HCons <Func <int, int>, HNil>, Func <int, int>, Func <int, int>, Apply <Unit, Tuple <Func <int, int>, Func <int, int> >, Func <int, int> >, HFoldr <Unit, Func <int, int>, HCons <Func <int, int>, HNil>, Func <int, int> > >(comp0, HFoldr.Hfoldr <Unit, Func <int, int>, Func <int, int>, HNil, Func <int, int>, Func <int, int>, Apply <Unit, Tuple <Func <int, int>, Func <int, int> >, Func <int, int> >, HFoldr <Unit, Func <int, int>, HNil, Func <int, int> > >(comp0, fold0))); Func <int, int> id = i => i; Console.WriteLine(fold2.FoldRight(null, id, functions)("abc")); }