For a really good article to see how foldr is in fact very powerful
and how you can make it do some funny tricks, see the Monad.Reader 6th
issue :
http://www.haskell.org/sitewiki/images/1/14/TMR-Issue6.pdf

I'll point out that you can write a lazy dropWhile with foldr in the
style of the first example of the article just by using a
non-refutable pattern in the combine function :

dWLazy p = snd . foldr (\a ~(x, y) -> if p a then (a : x, y) else (a :
x, a : x)) ([], [])

-- 
Jedaï
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to