[Haskell-beginners] Trying to understand the foldl type?

Angus Comber anguscomber at gmail.com
Tue Dec 24 13:19:42 UTC 2013


The type is:

foldl :: (a -> b -> a) -> a -> [b] -> a

Eg I might do something like this:

foldl (+) 0 [1..10]

so taking (a -> b -> a)

leftmost a is (+)
b is 0
right a is what?  The first value in the list?

Then -> ?

[b] ?  Is this like the temporary recursion calculation?

final -> a is the result?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20131224/9ba8917f/attachment.html>


More information about the Beginners mailing list