[Haskell-beginners] proper way to read fold types

Daniel Fischer daniel.is.fischer at web.de
Sat Jul 24 18:15:24 EDT 2010


On Saturday 24 July 2010 23:50:42, prad wrote:
> i know how i can use the folds in some situations, but explaining their
> type definitions to reveal how they work, is coming out pretty
> convoluted when i make the attempt. :(

Maybe this helps:

foldr op z [x1, x2, x3] = x1 `op` (x2 `op` (x3 `op` z))

foldr1 op [x1, x2, x3] = x1 `op` (x2 `op` x3)




More information about the Beginners mailing list