Writing foldLeft equivalent for recursion schemes This is a definition of foldr and foldl in terms of foldr: