foldr f (head xs) xs is not the same as foldr1 f xs

David Sabel sabel at ki.informatik.uni-frankfurt.de
Sun May 8 14:14:30 EDT 2005


Hi!

A small example for the claim mentioned in the subject:

Prelude> let x = 1:undefined in foldr (curry fst) (head x) x
1
Prelude> let x = 1:undefined in foldr1 (curry fst)  x
*** Exception: Prelude.undefined

Perhaps it would be better to change the implementation of foldr1?

Cheers,
  David


More information about the Glasgow-haskell-users mailing list