fold.hs 222 B

12345678910111213
  1. -- Exercice from slide 46
  2. fsum::Num a => [a] -> a
  3. fsum = foldl (+) 0
  4. fmax::(Ord a, Num a) => [a] -> a
  5. fmax = foldl max 0
  6. for::[Bool] -> Bool
  7. for = foldl (||) False
  8. fany::(a->Bool)->[a]->Bool
  9. fany p xs = for $ map p xs