I've got this
myFoldl f init [] = init
myFoldl f init (x:xs) = myFoldl f newInit xs
where newInit = f init x
which when evaluated gives this for its type
> :t myFoldl
myFoldl :: (t -> a -> t) -> t -> [a] -> t
. . . not totally sure what that all means, e.g., how the t as a generic class is behaving is very mysterious. Obviously, the final result is of type t . . . and that must relate to the incoming argument init, correct? (BTW, does a type declaration like this one reflect in any way the recursion going on?) But then with Prelude foldl I'm really clueless
> :t foldl
foldl :: Foldable t => (b -> a -> b) -> b -> t a -> b
I'm guessing the t is again a generic type of the Foldable class, but then. . . Can someone walk me through this?
LB