Hi,
foldl :: (a -> b -> a) -> a -> t b -> a
Them, outside of the class, foldr' is defined like this:
-- | Fold over the elements of a structure, -- associating to the right, but strictly. foldr' :: Foldable t => (a -> b -> b) -> b -> t a -> b foldr' f z0 xs = foldl f' id xs z0 where f' k x z = k $! f x z
I don't understand this definition, foldl receives 3 parameters and here it is used with 4, how is it possible?
Even the function passed to foldl has 3 parameters when a function of 2 is needed.
What is the precedence and associativity involved here that makes foldr' a valid expression?
Thanks!